4 #include <boost/lexical_cast.hpp> 33 this->checkConnection();
36 m_writeStmt = m_conn->createStatement();
38 m_writeStmt->setSQL(
"INSERT INTO run_tt_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(
"RunTTErrorsDat::prepareWrite(): "+e.getMessage()));
52 this->checkConnection();
55 int iovID = iov->fetchID();
56 if (!iovID) {
throw(std::runtime_error(
"RunTTErrorsDat::writeDB: IOV not in DB")); }
58 int logicID = ecid->getLogicID();
59 if (!logicID) {
throw(std::runtime_error(
"RunTTErrorsDat::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();
66 }
catch (SQLException &
e) {
67 throw(std::runtime_error(
"RunTTErrorsDat::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_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, RunTTErrorsDat >
p;
107 dat.
setErrorBits( boost::lexical_cast<uint64_t>(rset->getString(7)) );
113 }
catch (SQLException &
e) {
114 throw(std::runtime_error(
"RunTTErrorsDat::fetchData(): "+e.getMessage()));
void setErrorBits(uint64_t bits)
void writeDB(const EcalLogicID *ecid, const RunTTErrorsDat *item, RunIOV *iov) noexcept(false)
void fetchData(std::map< EcalLogicID, RunTTErrorsDat > *fillMap, RunIOV *iov) noexcept(false)
void prepareWrite() noexcept(false)