4 #include <boost/lexical_cast.hpp>
15 m_writeStmt =
nullptr;
24 this->checkConnection();
27 m_writeStmt = m_conn->createStatement();
30 "INSERT INTO run_pn_errors_dat (iov_id, logic_id, "
32 "VALUES (:iov_id, :logic_id, "
33 "to_number(:error_bits))");
34 }
catch (SQLException&
e) {
35 throw(std::runtime_error(
"RunPNErrorsDat::prepareWrite(): " +
e.getMessage()));
40 this->checkConnection();
43 int iovID = iov->fetchID();
45 throw(std::runtime_error(
"RunPNErrorsDat::writeDB: IOV not in DB"));
48 int logicID = ecid->getLogicID();
50 throw(std::runtime_error(
"RunPNErrorsDat::writeDB: Bad EcalLogicID"));
54 m_writeStmt->setInt(1, iovID);
55 m_writeStmt->setInt(2, logicID);
56 m_writeStmt->setString(3, std::to_string(
item->getErrorBits()));
57 m_writeStmt->executeUpdate();
58 }
catch (SQLException&
e) {
59 throw(std::runtime_error(
"RunPNErrorsDat::writeDB(): " +
e.getMessage()));
64 this->checkConnection();
67 iov->setConnection(m_env, m_conn);
68 int iovID = iov->fetchID();
77 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
78 "to_char(d.error_bits) "
79 "FROM channelview cv JOIN run_pn_errors_dat d "
80 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
81 "WHERE d.iov_id = :iov_id");
82 m_readStmt->setInt(1, iovID);
83 ResultSet* rset = m_readStmt->executeQuery();
85 std::pair<EcalLogicID, RunPNErrorsDat>
p;
87 while (rset->next()) {
95 dat.
setErrorBits(boost::lexical_cast<uint64_t>(rset->getString(7)));
101 }
catch (SQLException&
e) {
102 throw(std::runtime_error(
"RunPNErrorsDat::fetchData(): " +
e.getMessage()));