4 #include <boost/lexical_cast.hpp>
15 m_writeStmt =
nullptr;
23 this->checkConnection();
26 m_writeStmt = m_conn->createStatement();
29 "INSERT INTO run_mem_ch_errors_dat (iov_id, logic_id, "
31 "VALUES (:iov_id, :logic_id, "
32 "to_number(:error_bits))");
33 }
catch (SQLException&
e) {
34 throw(std::runtime_error(
"RunMemChErrorsDat::prepareWrite(): " +
e.getMessage()));
39 this->checkConnection();
42 int iovID = iov->fetchID();
44 throw(std::runtime_error(
"RunMemChErrorsDat::writeDB: IOV not in DB"));
47 int logicID = ecid->getLogicID();
49 throw(std::runtime_error(
"RunMemChErrorsDat::writeDB: Bad EcalLogicID"));
53 m_writeStmt->setInt(1, iovID);
54 m_writeStmt->setInt(2, logicID);
55 m_writeStmt->setString(3, std::to_string(
item->getErrorBits()));
56 m_writeStmt->executeUpdate();
57 }
catch (SQLException&
e) {
58 throw(std::runtime_error(
"RunMemChErrorsDat::writeDB(): " +
e.getMessage()));
63 this->checkConnection();
66 iov->setConnection(m_env, m_conn);
67 int iovID = iov->fetchID();
76 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
77 "to_char(d.error_bits) "
78 "FROM channelview cv JOIN run_mem_ch_errors_dat d "
79 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
80 "WHERE d.iov_id = :iov_id");
81 m_readStmt->setInt(1, iovID);
82 ResultSet* rset = m_readStmt->executeQuery();
84 std::pair<EcalLogicID, RunMemChErrorsDat>
p;
86 while (rset->next()) {
94 dat.
setErrorBits(boost::lexical_cast<uint64_t>(rset->getString(7)));
100 }
catch (SQLException&
e) {
101 throw(std::runtime_error(
"RunMemChErrorsDat::fetchData(): " +
e.getMessage()));