14 m_writeStmt =
nullptr;
21 this->checkConnection();
24 m_writeStmt = m_conn->createStatement();
27 "INSERT INTO run_crystal_errors_dat (iov_id, logic_id, " 29 "VALUES (:iov_id, :logic_id, " 30 "to_number(:error_bits))");
31 }
catch (SQLException&
e) {
32 throw(std::runtime_error(
"RunCrystalErrorsDat::prepareWrite(): " +
e.getMessage()));
38 RunIOV* iov) noexcept(
false) {
39 this->checkConnection();
42 int iovID = iov->fetchID();
44 throw(std::runtime_error(
"RunCrystalErrorsDat::writeDB: IOV not in DB"));
47 int logicID = ecid->getLogicID();
49 throw(std::runtime_error(
"RunCrystalErrorsDat::writeDB: Bad EcalLogicID"));
53 m_writeStmt->setInt(1, iovID);
54 m_writeStmt->setInt(2, logicID);
56 m_writeStmt->executeUpdate();
57 }
catch (SQLException&
e) {
58 throw(std::runtime_error(
"RunCrystalErrorsDat::writeDB(): " +
e.getMessage()));
63 this->checkConnection();
66 iov->setConnection(m_env, m_conn);
67 int iovID = iov->fetchID();
74 Statement* stmt = m_conn->createStatement();
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_crystal_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 stmt->setInt(1, iovID);
83 ResultSet* rset = stmt->executeQuery();
85 std::pair<EcalLogicID, RunCrystalErrorsDat>
p;
87 while (rset->next()) {
100 m_conn->terminateStatement(stmt);
102 }
catch (SQLException&
e) {
103 throw(std::runtime_error(
"RunCrystalErrorsDat::fetchData(): " +
e.getMessage()));
~RunCrystalErrorsDat() override
std::string to_string(const V &value)
void fetchData(std::map< EcalLogicID, RunCrystalErrorsDat > *fillMap, RunIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
void setErrorBits(uint64_t bits)
void writeDB(const EcalLogicID *ecid, const RunCrystalErrorsDat *item, RunIOV *iov) noexcept(false)