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";
32 oracle::occi::Connection* conn) :
LMFUnique(env, conn)
81 setInt(
"color_id", color_id);
136 setInt(
"trigType_id",
id);
197 attach(
"sequence", seqdat);
219 std::string sql =
"";
221 sql =
"SELECT LMF_IOV_ID FROM LMF_RUN_IOV WHERE SEQ_ID = :1 "
224 sql +=
"AND TAG_ID = :3";
238 std::string sql =
"SELECT TAG_ID, SEQ_ID, LMR, COLOR_ID, TRIG_TYPE, "
239 "SUBRUN_START, SUBRUN_END, SUBRUN_TYPE, DB_TIMESTAMP FROM LMF_RUN_IOV "
240 "WHERE LMF_IOV_ID = :1";
252 setInt(
"seq_id", seq->getID());
256 seq->setByID(rset->getInt(2));
257 setInt(
"seq_id", seq->getID());
260 setInt(
"lmr", rset->getInt(3));
263 Date start = rset->getDate(6);
265 Date stop = rset->getDate(7);
267 setString(
"subrun_type", rset->getString(8));
268 setString(
"db_timestamp", rset->getTimestamp(9).toText(
"YYYY-MM-DD HH24:MI:SS", 0));
295 int tag_id =
getInt(
"tag_id");
296 int seq_id =
getInt(
"seq_id");
297 int color_id =
getInt(
"color_id");
298 int tt =
getInt(
"trigType_id");
300 std::string sql =
"INSERT INTO LMF_RUN_IOV (LMF_IOV_ID, TAG_ID, SEQ_ID, "
301 "LMR, COLOR_ID, TRIG_TYPE, SUBRUN_START, SUBRUN_END, SUBRUN_TYPE) VALUES "
302 "(lmf_run_iov_" + sp +
"_sq.NextVal, :1, :2, :3, :4, :5, :6, :7, :8)";
305 stmt->setInt(1, tag_id);
306 stmt->setInt(2, seq_id);
307 stmt->setInt(3,
getInt(
"lmr"));
308 stmt->setInt(4, color_id);
317 const std::string &sql,
318 const std::string &method)
319 throw(std::runtime_error)
321 std::list<LMFRunIOV>
l;
322 this->checkConnection();
324 Statement *stmt = m_conn->createStatement();
326 for (
unsigned int i = 0;
i <
par.size();
i++) {
327 stmt->setInt(
i + 1,
par[
i]);
330 while (rset->next()) {
331 int lmf_iov_id = rset->getInt(1);
337 m_conn->terminateStatement(stmt);
339 throw(std::runtime_error(m_className +
"::" + method +
": " +
346 int seq_id = s.
getID();
348 parameters.push_back(seq_id);
349 return fetchBySequence(parameters,
"SELECT LMF_IOV_ID FROM LMF_RUN_IOV "
350 "WHERE SEQ_ID = :1",
"fetchBySequence");
354 int seq_id = s.
getID();
356 parameters.push_back(seq_id);
357 parameters.push_back(lmr);
358 return fetchBySequence(parameters,
"SELECT LMF_IOV_ID FROM LMF_RUN_IOV "
359 "WHERE SEQ_ID = :1 AND LMR = :2",
364 int type,
int color) {
365 int seq_id = s.
getID();
367 parameters.push_back(seq_id);
368 parameters.push_back(lmr);
369 parameters.push_back(color);
370 parameters.push_back(type);
371 return fetchBySequence(parameters,
"SELECT LMF_IOV_ID FROM LMF_RUN_IOV "
372 "WHERE SEQ_ID = :1 AND LMR = :2 AND COLOR_ID = :3 "
373 "AND TRIG_TYPE = :4",
380 int seq_id = s.
getID();
382 parameters.push_back(seq_id);
383 parameters.push_back(lmr);
384 parameters.push_back(color);
385 parameters.push_back(type);
387 "SEQ_ID, LMF_IOV_ID FROM LMF_RUN_IOV "
388 "WHERE SEQ_ID < :1 AND LMR = :2 AND COLOR_ID = :3 "
389 "AND TRIG_TYPE = :4 ORDER BY SEQ_ID DESC) WHERE "
nocap nocap const skelname & operator=(const skelname &)
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
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
const double par[8 *NPar][4]