14 m_intFields[
"lmr"] = 0;
15 m_intFields[
"tag_id"] = 0;
16 m_intFields[
"seq_id"] = 0;
17 m_intFields[
"color_id"] = 0;
18 m_intFields[
"trigType_id"] = 0;
19 m_stringFields[
"subrun_start"] = tm.
str();
20 m_stringFields[
"subrun_end"] = tm.
str();
21 m_stringFields[
"db_timestamp"] = tm.
str();
22 m_stringFields[
"subrun_type"] =
"none";
23 m_className =
"LMFRunIOV";
69 setInt(
"color_id", color_id);
119 setInt(
"trigType_id",
id);
175 attach(
"sequence", seqdat);
198 "SELECT LMF_IOV_ID FROM CMS_ECAL_LASER_COND.LMF_RUN_IOV WHERE " 202 sql +=
"AND TAG_ID = :3";
216 "SELECT TAG_ID, SEQ_ID, LMR, COLOR_ID, TRIG_TYPE, " 217 "SUBRUN_START, SUBRUN_END, SUBRUN_TYPE, DB_TIMESTAMP FROM " 218 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 219 "WHERE LMF_IOV_ID = :1";
227 setLMFRunTag(rset->getInt(1));
229 if (m_foreignKeys.find(
"sequence") != m_foreignKeys.end()) {
231 setInt(
"seq_id",
seq->getID());
234 seq->setConnection(m_env, m_conn);
235 seq->setByID(rset->getInt(2));
236 setInt(
"seq_id",
seq->getID());
239 setInt(
"lmr", rset->getInt(3));
240 setColor(rset->getInt(4));
241 setTriggerType(rset->getInt(5));
242 Date
start = rset->getDate(6);
243 setString(
"subrun_start",
dh.dateToTm(
start).str());
244 Date stop = rset->getDate(7);
245 setString(
"subrun_end",
dh.dateToTm(stop).str());
246 setString(
"subrun_type", rset->getString(8));
247 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 248 setString(
"db_timestamp", rset->getTimestamp(9).toText(
"YYYY-MM-DD HH24:MI:SS", 0));
251 unsigned int month = 0;
252 unsigned int day = 0;
253 unsigned int hour = 0;
254 unsigned int minute = 0;
257 rset->getTimestamp(9).getDate(
year, month,
day);
258 rset->getTimestamp(9).getTime(hour, minute,
second,
fs);
260 .tm_sec =
static_cast<int>(
second),
261 .tm_min = static_cast<int>(minute),
262 .tm_hour =
static_cast<int>(hour),
263 .tm_mday = static_cast<int>(
day),
264 .tm_mon =
static_cast<int>(month),
265 .tm_year =
year - 1900,
271 char tt_str[30] = {0};
272 if (std::strftime(tt_str,
sizeof(tt_str),
"%F %T", &
tt)) {
275 throw std::runtime_error(
276 "LMFRunIOV::getParameters: failed to generate the date string for 'db_timestamp' parameter");
304 int tag_id =
getInt(
"tag_id");
305 int seq_id =
getInt(
"seq_id");
306 int color_id =
getInt(
"color_id");
310 "INSERT INTO LMF_RUN_IOV (LMF_IOV_ID, TAG_ID, SEQ_ID, " 311 "LMR, COLOR_ID, TRIG_TYPE, SUBRUN_START, SUBRUN_END, SUBRUN_TYPE) VALUES " 313 sp +
"_sq.NextVal, :1, :2, :3, :4, :5, :6, :7, :8)";
316 stmt->setInt(1, tag_id);
317 stmt->setInt(2, seq_id);
318 stmt->setInt(3,
getInt(
"lmr"));
319 stmt->setInt(4, color_id);
330 std::list<LMFRunIOV>
l;
331 this->checkConnection();
333 Statement *stmt = m_conn->createStatement();
335 for (
unsigned int i = 0;
i < par.size();
i++) {
336 stmt->setInt(
i + 1, par[
i]);
339 while (rset->next() != 0) {
340 int lmf_iov_id = rset->getInt(1);
346 m_conn->terminateStatement(stmt);
347 }
catch (SQLException &
e) {
348 throw(std::runtime_error(m_className +
"::" +
method +
": " +
e.getMessage()));
354 int seq_id =
s.getID();
358 "SELECT LMF_IOV_ID FROM " 359 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 365 int seq_id =
s.getID();
370 "SELECT LMF_IOV_ID FROM " 371 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 372 "WHERE SEQ_ID = :1 AND LMR = :2",
377 int seq_id =
s.getID();
384 "SELECT LMF_IOV_ID FROM " 385 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 386 "WHERE SEQ_ID = :1 AND LMR = :2 AND COLOR_ID = :3 " 387 "AND TRIG_TYPE = :4",
392 int seq_id =
s.getID();
399 "SELECT LMF_IOV_ID FROM (SELECT " 400 "SEQ_ID, LMF_IOV_ID FROM " 401 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 402 "WHERE SEQ_ID < :1 AND LMR = :2 AND COLOR_ID = :3 " 403 "AND TRIG_TYPE = :4 ORDER BY SEQ_ID DESC) WHERE " 411 if (
r._fabric !=
nullptr) {
Tm getSubRunStart() const
LMFRunIOV & setSubRunStart(const Tm &start)
std::string getShortName() const
LMFUnique & setInt(std::string key, int value)
oracle::occi::Environment * m_env
Basic3DVector & operator=(const Basic3DVector &)=default
Assignment operator.
oracle::occi::Connection * m_conn
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
LMFSeqDat getSequence() const
LMFRunIOV & setLMFRunTag(const LMFRunTag &tag)
virtual LMFRunIOV & operator=(const LMFRunIOV &r)
ret
prodAgent to be discontinued
LMFRunIOV & setSubRunType(const std::string &x)
LMFRunTag getLMFRunTag() const
std::string fetchIdSql(Statement *stmt) override
std::string sequencePostfix(const Tm &t)
oracle::occi::ResultSet ResultSet
std::string getString(std::string fieldname) const
void setToCurrentGMTime()
void setByID(int id) noexcept(false) override
std::string getColorShortName() const
LMFRunIOV & setSubRunEnd(const Tm &end)
LMFRunIOV & setSequence(LMFSeqDat &seq)
U second(std::pair< T, U > const &p)
void dump() const override
year
get the greatest golden json
LMFRunIOV & setTriggerType(LMFTrigType &tt)
oracle::occi::Statement Statement
Tm getDBInsertionTime() const
int getColorID(std::string name) const
std::string setByIDSql(Statement *stmt, int id) override
virtual void dump() const
LMFUnique & setString(std::string key, std::string value)
std::string getLongName() const
std::string getSubRunType() const
LMFRunIOV & setColorIndex(int color_index)
int getInt(std::string fieldname) const
LMFRunIOV & setLmr(int n)
int getTrigTypeID(std::string sname) const
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
LMFTrigType getTriggerType() const
std::list< LMFRunIOV > fetchLastBeforeSequence(const LMFSeqDat &s, int lmr, int type, int color)
LMFRunIOV & setColor(const LMFColor &c)
void attach(std::string name, LMFUnique *u)
std::string writeDBSql(Statement *stmt) override
std::string getColorLongName() const
LMFColor getLMFColor() const
void getParameters(ResultSet *rset) override
std::map< std::string, int > m_intFields