15 m_writeStmt =
nullptr;
30 this->checkConnection();
33 m_writeStmt = m_conn->createStatement();
34 m_writeStmt->setSQL(
"INSERT INTO run_dat (iov_id, logic_id, " 36 "VALUES (:iov_id, :logic_id, " 38 }
catch (SQLException &
e) {
39 throw(std::runtime_error(
"RunDat::prepareWrite(): "+e.getMessage()));
48 this->checkConnection();
51 int iovID = iov->fetchID();
52 if (!iovID) {
throw(std::runtime_error(
"RunDat::writeDB: IOV not in DB")); }
54 int logicID = ecid->getLogicID();
55 if (!logicID) {
throw(std::runtime_error(
"RunDat::writeDB: Bad EcalLogicID")); }
58 m_writeStmt->setInt(1, iovID);
59 m_writeStmt->setInt(2, logicID);
60 m_writeStmt->setInt(3, item->getNumEvents());
62 m_writeStmt->executeUpdate();
63 }
catch (SQLException &
e) {
64 throw(std::runtime_error(
"RunDat::writeDB(): "+e.getMessage()));
73 this->checkConnection();
76 iov->setConnection(m_env, m_conn);
77 int iovID = iov->fetchID();
84 Statement* stmt = m_conn->createStatement();
85 stmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 87 "FROM channelview cv JOIN run_dat d " 88 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 89 "WHERE d.iov_id = :iov_id");
90 stmt->setInt(1, iovID);
91 ResultSet* rset = stmt->executeQuery();
93 std::pair< EcalLogicID, RunDat >
p;
108 m_conn->terminateStatement(stmt);
109 }
catch (SQLException &
e) {
110 throw(std::runtime_error(
"RunDat::fetchData(): "+e.getMessage()));
void fetchData(std::map< EcalLogicID, RunDat > *fillMap, RunIOV *iov) noexcept(false)
void setNumEvents(int num)
void writeDB(const EcalLogicID *ecid, const RunDat *item, RunIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override