4 #include <boost/lexical_cast.hpp>
10 using namespace oracle::occi;
30 throw(std::runtime_error)
32 this->checkConnection();
35 m_writeStmt = m_conn->createStatement();
37 m_writeStmt->setSQL(
"INSERT INTO run_mem_ch_errors_dat (iov_id, logic_id, "
39 "VALUES (:iov_id, :logic_id, "
40 "to_number(:error_bits))");
42 throw(std::runtime_error(
"RunMemChErrorsDat::prepareWrite(): "+e.getMessage()));
49 throw(std::runtime_error)
51 this->checkConnection();
54 int iovID =
iov->fetchID();
55 if (!iovID) {
throw(std::runtime_error(
"RunMemChErrorsDat::writeDB: IOV not in DB")); }
57 int logicID = ecid->getLogicID();
58 if (!logicID) {
throw(std::runtime_error(
"RunMemChErrorsDat::writeDB: Bad EcalLogicID")); }
61 m_writeStmt->setInt(1, iovID);
62 m_writeStmt->setInt(2, logicID);
63 m_writeStmt->setString(3, ( boost::lexical_cast<std::string>(item->getErrorBits()) ).c_str());
64 m_writeStmt->executeUpdate();
66 throw(std::runtime_error(
"RunMemChErrorsDat::writeDB(): "+e.getMessage()));
73 throw(std::runtime_error)
75 this->checkConnection();
78 iov->setConnection(m_env, m_conn);
79 int iovID =
iov->fetchID();
88 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
89 "to_char(d.error_bits) "
90 "FROM channelview cv JOIN run_mem_ch_errors_dat d "
91 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
92 "WHERE d.iov_id = :iov_id");
93 m_readStmt->setInt(1, iovID);
94 ResultSet* rset = m_readStmt->executeQuery();
96 std::pair< EcalLogicID, RunMemChErrorsDat >
p;
106 dat.
setErrorBits( boost::lexical_cast<uint64_t>(rset->getString(7)) );
114 throw(std::runtime_error(
"RunMemChErrorsDat::fetchData(): "+e.getMessage()));
void writeDB(const EcalLogicID *ecid, const RunMemChErrorsDat *item, RunIOV *iov)
oracle::occi::SQLException SQLException
void setErrorBits(uint64_t bits)
static std::vector< std::string > checklist dat
oracle::occi::ResultSet ResultSet
void fetchData(std::map< EcalLogicID, RunMemChErrorsDat > *fillMap, RunIOV *iov)