14 m_writeStmt =
nullptr;
26 this->checkConnection();
29 m_writeStmt = m_conn->createStatement();
31 "INSERT INTO run_h4_table_position_dat (iov_id, logic_id, " 32 "table_x, table_y, number_of_spills, number_of_events ) " 33 "VALUES (:iov_id, :logic_id, " 34 ":table_x, :table_y, :number_of_spills, :number_of_events)");
35 }
catch (SQLException&
e) {
36 throw(std::runtime_error(
"RunH4TablePositionDat::prepareWrite(): " +
e.getMessage()));
42 RunIOV* iov) noexcept(
false) {
43 this->checkConnection();
46 int iovID = iov->fetchID();
48 throw(std::runtime_error(
"RunH4TablePositionDat::writeDB: IOV not in DB"));
51 int logicID = ecid->getLogicID();
53 throw(std::runtime_error(
"RunH4TablePositionDat::writeDB: Bad EcalLogicID"));
57 m_writeStmt->setInt(1, iovID);
58 m_writeStmt->setInt(2, logicID);
59 m_writeStmt->setInt(3,
item->getTableX());
60 m_writeStmt->setInt(4,
item->getTableY());
61 m_writeStmt->setInt(5,
item->getNumSpills());
62 m_writeStmt->setInt(6,
item->getNumEvents());
64 m_writeStmt->executeUpdate();
65 }
catch (SQLException&
e) {
66 throw(std::runtime_error(
"RunH4TablePositionDat::writeDB(): " +
e.getMessage()));
71 this->checkConnection();
74 iov->setConnection(m_env, m_conn);
75 int iovID = iov->fetchID();
83 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 84 "d.table_x, d.table_y, d.number_of_spills, d.number_of_events " 85 "FROM channelview cv JOIN run_h4_table_position_dat d " 86 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 87 "WHERE d.iov_id = :iov_id");
88 m_readStmt->setInt(1, iovID);
89 ResultSet* rset = m_readStmt->executeQuery();
91 std::pair<EcalLogicID, RunH4TablePositionDat>
p;
93 while (rset->next()) {
110 }
catch (SQLException&
e) {
111 throw(std::runtime_error(
"RunH4TablePositionDat::fetchData(): " +
e.getMessage()));
void writeDB(const EcalLogicID *ecid, const RunH4TablePositionDat *item, RunIOV *iov) noexcept(false)
~RunH4TablePositionDat() override
void fetchData(std::map< EcalLogicID, RunH4TablePositionDat > *fillMap, RunIOV *iov) noexcept(false)
void setNumSpills(int num)
void prepareWrite() noexcept(false) override
void setNumEvents(int num)