4 #include <boost/lexical_cast.hpp> 33 this->checkConnection();
36 m_writeStmt = m_conn->createStatement();
38 m_writeStmt->setSQL(
"INSERT INTO run_pn_errors_dat (iov_id, logic_id, " 40 "VALUES (:iov_id, :logic_id, " 41 "to_number(:error_bits))");
42 }
catch (SQLException &
e) {
43 throw(std::runtime_error(
"RunPNErrorsDat::prepareWrite(): "+e.getMessage()));
52 this->checkConnection();
55 int iovID = iov->fetchID();
56 if (!iovID) {
throw(std::runtime_error(
"RunPNErrorsDat::writeDB: IOV not in DB")); }
58 int logicID = ecid->getLogicID();
59 if (!logicID) {
throw(std::runtime_error(
"RunPNErrorsDat::writeDB: Bad EcalLogicID")); }
62 m_writeStmt->setInt(1, iovID);
63 m_writeStmt->setInt(2, logicID);
64 m_writeStmt->setString(3, ( std::to_string(item->getErrorBits()) ).c_str());
65 m_writeStmt->executeUpdate();
66 }
catch (SQLException &
e) {
67 throw(std::runtime_error(
"RunPNErrorsDat::writeDB(): "+e.getMessage()));
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_pn_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, RunPNErrorsDat >
p;
107 dat.
setErrorBits( boost::lexical_cast<uint64_t>(rset->getString(7)) );
114 }
catch (SQLException &
e) {
115 throw(std::runtime_error(
"RunPNErrorsDat::fetchData(): "+e.getMessage()));
void prepareWrite() noexcept(false)
void fetchData(std::map< EcalLogicID, RunPNErrorsDat > *fillMap, RunIOV *iov) noexcept(false)
void setErrorBits(uint64_t bits)
void writeDB(const EcalLogicID *ecid, const RunPNErrorsDat *item, RunIOV *iov) noexcept(false)