9 using namespace oracle::occi;
28 throw(std::runtime_error)
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, "
39 throw(std::runtime_error(
"RunDat::prepareWrite(): "+e.getMessage()));
46 throw(std::runtime_error)
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();
64 throw(std::runtime_error(
"RunDat::writeDB(): "+e.getMessage()));
71 throw(std::runtime_error)
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);
93 std::pair< EcalLogicID, RunDat >
p;
108 m_conn->terminateStatement(stmt);
110 throw(std::runtime_error(
"RunDat::fetchData(): "+e.getMessage()));
oracle::occi::SQLException SQLException
void setNumEvents(int num)
void writeDB(const EcalLogicID *ecid, const RunDat *item, RunIOV *iov)
oracle::occi::ResultSet ResultSet
void fetchData(std::map< EcalLogicID, RunDat > *fillMap, RunIOV *iov)