9 using namespace oracle::occi;
33 throw(std::runtime_error)
35 this->checkConnection();
38 m_writeStmt = m_conn->createStatement();
39 m_writeStmt->setSQL(
"INSERT INTO run_h4_table_position_dat (iov_id, logic_id, "
40 "table_x, table_y, number_of_spills, number_of_events ) "
41 "VALUES (:iov_id, :logic_id, "
42 ":table_x, :table_y, :number_of_spills, :number_of_events)");
44 throw(std::runtime_error(
"RunH4TablePositionDat::prepareWrite(): "+e.getMessage()));
51 throw(std::runtime_error)
53 this->checkConnection();
56 int iovID =
iov->fetchID();
57 if (!iovID) {
throw(std::runtime_error(
"RunH4TablePositionDat::writeDB: IOV not in DB")); }
59 int logicID = ecid->getLogicID();
60 if (!logicID) {
throw(std::runtime_error(
"RunH4TablePositionDat::writeDB: Bad EcalLogicID")); }
63 m_writeStmt->setInt(1, iovID);
64 m_writeStmt->setInt(2, logicID);
65 m_writeStmt->setInt(3, item->getTableX());
66 m_writeStmt->setInt(4, item->getTableY());
67 m_writeStmt->setInt(5, item->getNumSpills());
68 m_writeStmt->setInt(6, item->getNumEvents());
70 m_writeStmt->executeUpdate();
72 throw(std::runtime_error(
"RunH4TablePositionDat::writeDB(): "+e.getMessage()));
79 throw(std::runtime_error)
81 this->checkConnection();
84 iov->setConnection(m_env, m_conn);
85 int iovID =
iov->fetchID();
93 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
94 "d.table_x, d.table_y, d.number_of_spills, d.number_of_events "
95 "FROM channelview cv JOIN run_h4_table_position_dat d "
96 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
97 "WHERE d.iov_id = :iov_id");
98 m_readStmt->setInt(1, iovID);
99 ResultSet* rset = m_readStmt->executeQuery();
101 std::pair< EcalLogicID, RunH4TablePositionDat >
p;
103 while(rset->next()) {
121 throw(std::runtime_error(
"RunH4TablePositionDat::fetchData(): "+e.getMessage()));
oracle::occi::SQLException SQLException
void setNumSpills(int num)
oracle::occi::ResultSet ResultSet
void setNumEvents(int num)
void fillMap(Registry *reg, regmap_type &fillme)
void fetchData(std::map< EcalLogicID, RunH4TablePositionDat > *fillMap, RunIOV *iov)
void writeDB(const EcalLogicID *ecid, const RunH4TablePositionDat *item, RunIOV *iov)