6 using namespace oracle::occi;
12 m_intFields[
"lmr"] = 0;
13 m_intFields[
"tag_id"] = 0;
14 m_intFields[
"seq_id"] = 0;
15 m_intFields[
"color_id"] = 0;
16 m_intFields[
"trigType_id"] = 0;
17 m_stringFields[
"subrun_start"] = tm.
str();
18 m_stringFields[
"subrun_end"] = tm.
str();
19 m_stringFields[
"db_timestamp"] = tm.
str();
20 m_stringFields[
"subrun_type"] =
"none";
21 m_className =
"LMFRunIOV";
81 setInt(
"color_id", color_id);
136 setInt(
"trigType_id",
id);
197 attach(
"sequence", seqdat);
221 sql =
"SELECT LMF_IOV_ID FROM CMS_ECAL_LASER_COND.LMF_RUN_IOV WHERE "
225 sql +=
"AND TAG_ID = :3";
239 std::string sql =
"SELECT TAG_ID, SEQ_ID, LMR, COLOR_ID, TRIG_TYPE, "
240 "SUBRUN_START, SUBRUN_END, SUBRUN_TYPE, DB_TIMESTAMP FROM "
241 "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
242 "WHERE LMF_IOV_ID = :1";
254 setInt(
"seq_id", seq->getID());
258 seq->setByID(rset->getInt(2));
259 setInt(
"seq_id", seq->getID());
262 setInt(
"lmr", rset->getInt(3));
265 Date
start = rset->getDate(6);
267 Date stop = rset->getDate(7);
269 setString(
"subrun_type", rset->getString(8));
270 setString(
"db_timestamp", rset->getTimestamp(9).toText(
"YYYY-MM-DD HH24:MI:SS", 0));
297 int tag_id =
getInt(
"tag_id");
298 int seq_id =
getInt(
"seq_id");
299 int color_id =
getInt(
"color_id");
302 std::string sql =
"INSERT INTO LMF_RUN_IOV (LMF_IOV_ID, TAG_ID, SEQ_ID, "
303 "LMR, COLOR_ID, TRIG_TYPE, SUBRUN_START, SUBRUN_END, SUBRUN_TYPE) VALUES "
304 "(lmf_run_iov_" + sp +
"_sq.NextVal, :1, :2, :3, :4, :5, :6, :7, :8)";
307 stmt->setInt(1, tag_id);
308 stmt->setInt(2, seq_id);
309 stmt->setInt(3,
getInt(
"lmr"));
310 stmt->setInt(4, color_id);
321 throw(std::runtime_error)
323 std::list<LMFRunIOV>
l;
324 this->checkConnection();
326 Statement *stmt = m_conn->createStatement();
328 for (
unsigned int i = 0;
i < par.size();
i++) {
329 stmt->setInt(
i + 1, par[
i]);
332 while (rset->next() != 0) {
333 int lmf_iov_id = rset->getInt(1);
339 m_conn->terminateStatement(stmt);
341 throw(std::runtime_error(m_className +
"::" +
method +
": " +
348 int seq_id = s.
getID();
350 parameters.push_back(seq_id);
352 "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
353 "WHERE SEQ_ID = :1",
"fetchBySequence");
357 int seq_id = s.
getID();
359 parameters.push_back(seq_id);
360 parameters.push_back(lmr);
362 "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
363 "WHERE SEQ_ID = :1 AND LMR = :2",
369 int seq_id = s.
getID();
371 parameters.push_back(seq_id);
372 parameters.push_back(lmr);
373 parameters.push_back(color);
374 parameters.push_back(type);
376 "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
377 "WHERE SEQ_ID = :1 AND LMR = :2 AND COLOR_ID = :3 "
378 "AND TRIG_TYPE = :4",
385 int seq_id = s.
getID();
387 parameters.push_back(seq_id);
388 parameters.push_back(lmr);
389 parameters.push_back(color);
390 parameters.push_back(type);
392 "SEQ_ID, LMF_IOV_ID FROM "
393 "CMS_ECAL_LASER_COND.LMF_RUN_IOV "
394 "WHERE SEQ_ID < :1 AND LMR = :2 AND COLOR_ID = :3 "
395 "AND TRIG_TYPE = :4 ORDER BY SEQ_ID DESC) WHERE "
402 LMFUnique::operator=(r);
std::string getSubRunType() const
void getParameters(ResultSet *rset)
LMFUnique & setInt(std::string key, int value)
oracle::occi::Environment * m_env
oracle::occi::Connection * m_conn
tuple start
Check for commandline option errors.
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
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 & setSequence(LMFSeqDat &seq)
std::string getLongName() const
std::string sequencePostfix(Tm t)
LMFRunIOV & setSubRunStart(Tm start)
std::string setByIDSql(Statement *stmt, int id)
LMFSeqDat getSequence() const
LMFRunIOV & setTriggerType(LMFTrigType &tt)
oracle::occi::Statement Statement
void setToString(const std::string s)
LMFTrigType getTriggerType() const
std::string getShortName() const
oracle::occi::Date tmToDate(const Tm &inTm) const
std::map< std::string, LMFUnique * > m_foreignKeys
LMFRunIOV & setSubRunEnd(Tm end)
LMFUnique & setString(std::string key, std::string value)
virtual void dump() const
int getTrigTypeID(std::string sname) const
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