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";
34 oracle::occi::Connection* conn) :
LMFUnique(env, conn)
83 setInt(
"color_id", color_id);
138 setInt(
"trigType_id",
id);
200 attach(
"sequence", seqdat);
224 sql =
"SELECT LMF_IOV_ID FROM CMS_ECAL_LASER_COND.LMF_RUN_IOV WHERE " 228 sql +=
"AND TAG_ID = :3";
242 std::string sql =
"SELECT TAG_ID, SEQ_ID, LMR, COLOR_ID, TRIG_TYPE, " 243 "SUBRUN_START, SUBRUN_END, SUBRUN_TYPE, DB_TIMESTAMP FROM " 244 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 245 "WHERE LMF_IOV_ID = :1";
257 setInt(
"seq_id", seq->getID());
261 seq->setByID(rset->getInt(2));
262 setInt(
"seq_id", seq->getID());
265 setInt(
"lmr", rset->getInt(3));
268 Date
start = rset->getDate(6);
270 Date stop = rset->getDate(7);
272 setString(
"subrun_type", rset->getString(8));
273 #if defined(_GLIBCXX_USE_CXX11_ABI) && (_GLIBCXX_USE_CXX11_ABI == 0) 274 setString(
"db_timestamp", rset->getTimestamp(9).toText(
"YYYY-MM-DD HH24:MI:SS", 0));
277 unsigned int month = 0;
278 unsigned int day = 0;
279 unsigned int hour = 0;
280 unsigned int minute = 0;
283 rset->getTimestamp(9).getDate(year, month, day);
284 rset->getTimestamp(9).getTime(hour, minute, second, fs);
287 .tm_sec =
static_cast<int>(
second),
288 .tm_min = static_cast<int>(minute),
289 .tm_hour =
static_cast<int>(hour),
290 .tm_mday = static_cast<int>(day),
291 .tm_mon =
static_cast<int>(month),
292 .tm_year = year - 1900
294 char tt_str[30] = { 0 };
295 if (std::strftime(tt_str,
sizeof(tt_str),
"%F %T", &
tt)) {
298 throw std::runtime_error(
"LMFRunIOV::getParameters: failed to generate the date string for 'db_timestamp' parameter");
327 int tag_id =
getInt(
"tag_id");
328 int seq_id =
getInt(
"seq_id");
329 int color_id =
getInt(
"color_id");
332 std::string sql =
"INSERT INTO LMF_RUN_IOV (LMF_IOV_ID, TAG_ID, SEQ_ID, " 333 "LMR, COLOR_ID, TRIG_TYPE, SUBRUN_START, SUBRUN_END, SUBRUN_TYPE) VALUES " 334 "(lmf_run_iov_" + sp +
"_sq.NextVal, :1, :2, :3, :4, :5, :6, :7, :8)";
337 stmt->setInt(1, tag_id);
338 stmt->setInt(2, seq_id);
339 stmt->setInt(3,
getInt(
"lmr"));
340 stmt->setInt(4, color_id);
353 std::list<LMFRunIOV>
l;
358 for (
unsigned int i = 0;
i < par.size();
i++) {
359 stmt->setInt(
i + 1, par[
i]);
362 while (rset->next() != 0) {
363 int lmf_iov_id = rset->getInt(1);
369 m_conn->terminateStatement(stmt);
378 int seq_id = s.
getID();
380 parameters.push_back(seq_id);
382 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 383 "WHERE SEQ_ID = :1",
"fetchBySequence");
387 int seq_id = s.
getID();
389 parameters.push_back(seq_id);
390 parameters.push_back(lmr);
392 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 393 "WHERE SEQ_ID = :1 AND LMR = :2",
399 int seq_id = s.
getID();
401 parameters.push_back(seq_id);
402 parameters.push_back(lmr);
403 parameters.push_back(color);
404 parameters.push_back(type);
406 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 407 "WHERE SEQ_ID = :1 AND LMR = :2 AND COLOR_ID = :3 " 408 "AND TRIG_TYPE = :4",
415 int seq_id = s.
getID();
417 parameters.push_back(seq_id);
418 parameters.push_back(lmr);
419 parameters.push_back(color);
420 parameters.push_back(type);
422 "SEQ_ID, LMF_IOV_ID FROM " 423 "CMS_ECAL_LASER_COND.LMF_RUN_IOV " 424 "WHERE SEQ_ID < :1 AND LMR = :2 AND COLOR_ID = :3 " 425 "AND TRIG_TYPE = :4 ORDER BY SEQ_ID DESC) WHERE " 432 LMFUnique::operator=(r);
std::string getSubRunType() const
void getParameters(ResultSet *rset)
LMFRunIOV & setSubRunStart(const Tm &start)
LMFUnique & setInt(std::string key, int value)
oracle::occi::Environment * m_env
oracle::occi::Connection * m_conn
std::list< LMFRunIOV > fetchBySequence(const LMFSeqDat &s)
std::string fetchIdSql(Statement *stmt)
LMFRunIOV & setLMFRunTag(const LMFRunTag &tag)
virtual LMFRunIOV & operator=(const LMFRunIOV &r)
LMFRunIOV & setSubRunType(const std::string &x)
Tm getDBInsertionTime() const
Tm getSubRunStart() const
LMFColor getLMFColor() const
std::string sequencePostfix(const Tm &t)
oracle::occi::ResultSet ResultSet
std::string getColorShortName() const
int getColorID(std::string name) const
virtual void dump() const
void setToCurrentGMTime()
oracle::occi::SQLException SQLException
int getInt(std::string fieldname) const
LMFRunIOV & setSubRunEnd(const Tm &end)
LMFRunIOV & setSequence(LMFSeqDat &seq)
U second(std::pair< T, U > const &p)
void setByID(int id) noexcept(false)
std::string getLongName() const
std::string setByIDSql(Statement *stmt, int id)
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::map< std::string, LMFUnique * > m_foreignKeys
LMFUnique & setString(std::string key, std::string value)
virtual void dump() const
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)
std::map< std::string, int > m_intFields