4 #include <boost/lexical_cast.hpp>
10 using namespace oracle::occi;
31 throw(std::runtime_error)
33 this->checkConnection();
36 m_writeStmt = m_conn->createStatement();
38 m_writeStmt->setSQL(
"INSERT INTO run_mem_tt_errors_dat (iov_id, logic_id, "
40 "VALUES (:iov_id, :logic_id, "
41 "to_number(:error_bits))");
43 throw(std::runtime_error(
"RunMemTTErrorsDat::prepareWrite(): "+e.getMessage()));
50 throw(std::runtime_error)
52 this->checkConnection();
55 int iovID =
iov->fetchID();
56 if (!iovID) {
throw(std::runtime_error(
"RunMemTTErrorsDat::writeDB: IOV not in DB")); }
58 int logicID = ecid->getLogicID();
59 if (!logicID) {
throw(std::runtime_error(
"RunMemTTErrorsDat::writeDB: Bad EcalLogicID")); }
62 m_writeStmt->setInt(1, iovID);
63 m_writeStmt->setInt(2, logicID);
64 m_writeStmt->setString(3, ( boost::lexical_cast<std::string>(item->getErrorBits()) ).c_str());
65 m_writeStmt->executeUpdate();
67 throw(std::runtime_error(
"RunMemTTErrorsDat::writeDB(): "+e.getMessage()));
74 throw(std::runtime_error)
76 this->checkConnection();
79 iov->setConnection(m_env, m_conn);
80 int iovID =
iov->fetchID();
89 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
90 "to_char(d.error_bits) "
91 "FROM channelview cv JOIN run_mem_tt_errors_dat d "
92 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
93 "WHERE d.iov_id = :iov_id");
94 m_readStmt->setInt(1, iovID);
95 ResultSet* rset = m_readStmt->executeQuery();
97 std::pair< EcalLogicID, RunMemTTErrorsDat >
p;
107 dat.
setErrorBits( boost::lexical_cast<uint64_t>(rset->getString(7)) );
115 throw(std::runtime_error(
"RunMemTTErrorsDat::fetchData(): "+e.getMessage()));
void writeDB(const EcalLogicID *ecid, const RunMemTTErrorsDat *item, RunIOV *iov)
oracle::occi::SQLException SQLException
oracle::occi::ResultSet ResultSet
void setErrorBits(uint64_t bits)
void fetchData(std::map< EcalLogicID, RunMemTTErrorsDat > *fillMap, RunIOV *iov)