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";
231 setInt(
"seq_id", seq->getID());
235 seq->setByID(rset->getInt(2));
236 setInt(
"seq_id", seq->getID());
239 setInt(
"lmr", rset->getInt(3));
242 Date
start = rset->getDate(6);
244 Date stop = rset->getDate(7);
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;
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) {
354 int seq_id = s.
getID();
356 parameters.push_back(seq_id);
358 "SELECT LMF_IOV_ID FROM " 359 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 365 int seq_id = s.
getID();
367 parameters.push_back(seq_id);
368 parameters.push_back(lmr);
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();
379 parameters.push_back(seq_id);
380 parameters.push_back(lmr);
381 parameters.push_back(color);
382 parameters.push_back(type);
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();
394 parameters.push_back(seq_id);
395 parameters.push_back(lmr);
396 parameters.push_back(color);
397 parameters.push_back(type);
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 " 410 LMFUnique::operator=(r);
std::string getSubRunType() const
LMFRunIOV & setSubRunStart(const Tm &start)
LMFUnique & setInt(std::string key, int value)
oracle::occi::Environment * m_env
oracle::occi::Connection * m_conn
void dump() const override
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
LMFRunIOV & setLMFRunTag(const LMFRunTag &tag)
virtual LMFRunIOV & operator=(const LMFRunIOV &r)
ret
prodAgent to be discontinued
LMFRunIOV & setSubRunType(const std::string &x)
Tm getDBInsertionTime() const
Tm getSubRunStart() const
LMFColor getLMFColor() const
std::string fetchIdSql(Statement *stmt) override
std::string sequencePostfix(const Tm &t)
oracle::occi::ResultSet ResultSet
std::map< std::string, LMFUnique * > m_foreignKeys
std::string getColorShortName() const
int getColorID(std::string name) const
virtual void dump() const
void setToCurrentGMTime()
void setByID(int id) noexcept(false) override
int getInt(std::string fieldname) const
LMFRunIOV & setSubRunEnd(const Tm &end)
LMFRunIOV & setSequence(LMFSeqDat &seq)
U second(std::pair< T, U > const &p)
std::string getLongName() const
LMFSeqDat getSequence() const
LMFRunIOV & setTriggerType(LMFTrigType &tt)
void checkConnection() const noexcept(false)
oracle::occi::Statement Statement
LMFTrigType getTriggerType() const
std::string getShortName() const
oracle::occi::Date tmToDate(const Tm &inTm) const
std::string setByIDSql(Statement *stmt, int id) override
LMFUnique & setString(std::string key, std::string value)
int getTrigTypeID(std::string sname) const
void setToString(const std::string s) noexcept(false)
LMFRunIOV & setColorIndex(int color_index)
std::string getColorLongName() const
LMFRunIOV & setLmr(int n)
std::string getString(std::string fieldname) const
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
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)
Tm dateToTm(oracle::occi::Date &date) const
LMFRunTag getLMFRunTag() const
std::string writeDBSql(Statement *stmt) override
void getParameters(ResultSet *rset) override
std::map< std::string, int > m_intFields