4 #include <boost/lexical_cast.hpp> 16 m_writeStmt =
nullptr;
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))");
41 }
catch (SQLException &
e) {
42 throw(std::runtime_error(
std::string(
"RunMemChErrorsDat::prepareWrite(): ")+getOraMessage(&e)));
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, std::to_string(item->getErrorBits()));
64 m_writeStmt->executeUpdate();
65 }
catch (SQLException &
e) {
66 throw(std::runtime_error(
std::string(
"RunMemChErrorsDat::writeDB(): ")+getOraMessage(&e)));
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;
104 getOraString(rset,6));
106 dat.
setErrorBits( boost::lexical_cast<uint64_t>(getOraString(rset,7)) );
113 }
catch (SQLException &
e) {
114 throw(std::runtime_error(
std::string(
"RunMemChErrorsDat::fetchData(): ")+getOraMessage(&e)));
~RunMemChErrorsDat() override
void writeDB(const EcalLogicID *ecid, const RunMemChErrorsDat *item, RunIOV *iov) noexcept(false)
void setErrorBits(uint64_t bits)
void fetchData(std::map< EcalLogicID, RunMemChErrorsDat > *fillMap, RunIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override