16 m_writeStmt =
nullptr;
37 this->checkConnection();
40 m_writeStmt = m_conn->createStatement();
41 m_writeStmt->setSQL(
"INSERT INTO mon_run_dat (iov_id, logic_id, " 42 "num_events, run_outcome_id, rootfile_name, task_list, task_outcome) " 43 "VALUES (:iov_id, :logic_id, " 44 ":num_events, :run_outcome_id, :rootfile_name, :task_list, :task_outcome) ");
45 }
catch (SQLException &
e) {
46 throw(std::runtime_error(
"MonRunDat::prepareWrite(): "+e.getMessage()));
55 this->checkConnection();
58 int iovID = iov->fetchID();
59 if (!iovID) {
throw(std::runtime_error(
"MonRunDat::writeDB: IOV not in DB")); }
63 int outcomeID = monRunOutcomeDef.
fetchID();
64 if (!outcomeID) {
throw(std::runtime_error(
"MonRunDat::writeDB: Outcome Definition not in DB")); }
66 int logicID = ecid->getLogicID();
67 if (!logicID) {
throw(std::runtime_error(
"MonRunDat::writeDB: Bad EcalLogicID")); }
70 m_writeStmt->setInt(1, iovID);
71 m_writeStmt->setInt(2, logicID);
72 m_writeStmt->setInt(3, item->getNumEvents());
73 m_writeStmt->setInt(4, outcomeID);
74 m_writeStmt->setString(5, item->getRootfileName());
75 m_writeStmt->setInt(6, item->getTaskList());
76 m_writeStmt->setInt(7, item->getTaskOutcome());
78 m_writeStmt->executeUpdate();
79 }
catch (SQLException &
e) {
80 throw(std::runtime_error(
"MonRunDat::writeDB(): "+e.getMessage()));
89 this->checkConnection();
92 iov->setConnection(m_env, m_conn);
93 int iovID = iov->fetchID();
101 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 102 "d.num_events, d.run_outcome_id, d.rootfile_name, d.task_list, d.task_outcome " 103 "FROM channelview cv JOIN mon_run_dat d " 104 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 105 "WHERE d.iov_id = :iov_id");
106 m_readStmt->setInt(1, iovID);
107 ResultSet* rset = m_readStmt->executeQuery();
109 std::pair< EcalLogicID, MonRunDat >
p;
113 while(rset->next()) {
122 outcomeDef.
setByID( rset->getInt(8) );
131 }
catch (SQLException &
e) {
132 throw(std::runtime_error(
"MonRunDat::fetchData(): "+e.getMessage()));
void setTaskList(int list)
void setNumEvents(int num)
void setMonRunOutcomeDef(const MonRunOutcomeDef &outcomeDef)
void setByID(int id) noexcept(false) override
void fetchData(std::map< EcalLogicID, MonRunDat > *fillMap, MonRunIOV *iov) noexcept(false)
void writeDB(const EcalLogicID *ecid, const MonRunDat *item, MonRunIOV *iov) noexcept(false)
void setRootfileName(std::string name)
int fetchID() noexcept(false) override
void setTaskOutcome(int outcome)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
void prepareWrite() noexcept(false) override