4 #include <boost/lexical_cast.hpp> 16 m_writeStmt =
nullptr;
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(
std::string(
"RunTTErrorsDat::prepareWrite(): ")+getOraMessage(&e)));
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, std::to_string(item->getErrorBits()));
65 m_writeStmt->executeUpdate();
66 }
catch (SQLException &
e) {
67 throw(std::runtime_error(
std::string(
"RunTTErrorsDat::writeDB(): ")+getOraMessage(&e)));
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;
105 getOraString(rset,6));
107 dat.
setErrorBits( boost::lexical_cast<uint64_t>(getOraString(rset,7)) );
113 }
catch (SQLException &
e) {
114 throw(std::runtime_error(
std::string(
"RunTTErrorsDat::fetchData(): ")+getOraMessage(&e)));
~RunTTErrorsDat() override
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) override