15 m_writeStmt =
nullptr;
28 this->checkConnection();
31 m_writeStmt = m_conn->createStatement();
33 "INSERT INTO mon_run_dat (iov_id, logic_id, " 34 "num_events, run_outcome_id, rootfile_name, task_list, task_outcome) " 35 "VALUES (:iov_id, :logic_id, " 36 ":num_events, :run_outcome_id, :rootfile_name, :task_list, :task_outcome) ");
37 }
catch (SQLException&
e) {
38 throw(std::runtime_error(
"MonRunDat::prepareWrite(): " +
e.getMessage()));
43 this->checkConnection();
46 int iovID = iov->fetchID();
48 throw(std::runtime_error(
"MonRunDat::writeDB: IOV not in DB"));
53 int outcomeID = monRunOutcomeDef.
fetchID();
55 throw(std::runtime_error(
"MonRunDat::writeDB: Outcome Definition not in DB"));
58 int logicID = ecid->getLogicID();
60 throw(std::runtime_error(
"MonRunDat::writeDB: Bad EcalLogicID"));
64 m_writeStmt->setInt(1, iovID);
65 m_writeStmt->setInt(2, logicID);
66 m_writeStmt->setInt(3,
item->getNumEvents());
67 m_writeStmt->setInt(4, outcomeID);
68 m_writeStmt->setString(5,
item->getRootfileName());
69 m_writeStmt->setInt(6,
item->getTaskList());
70 m_writeStmt->setInt(7,
item->getTaskOutcome());
72 m_writeStmt->executeUpdate();
73 }
catch (SQLException&
e) {
74 throw(std::runtime_error(
"MonRunDat::writeDB(): " +
e.getMessage()));
79 this->checkConnection();
82 iov->setConnection(m_env, m_conn);
83 int iovID = iov->fetchID();
91 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 92 "d.num_events, d.run_outcome_id, d.rootfile_name, d.task_list, d.task_outcome " 93 "FROM channelview cv JOIN mon_run_dat d " 94 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 95 "WHERE d.iov_id = :iov_id");
96 m_readStmt->setInt(1, iovID);
97 ResultSet* rset = m_readStmt->executeQuery();
99 std::pair<EcalLogicID, MonRunDat>
p;
103 while (rset->next()) {
112 outcomeDef.
setByID(rset->getInt(8));
121 }
catch (SQLException&
e) {
122 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