15 m_writeStmt =
nullptr;
25 this->checkConnection();
28 m_writeStmt = m_conn->createStatement();
30 "INSERT INTO cali_hv_scan_ratio_dat (iov_id, logic_id, " 31 "hvratio, hvratio_rms, task_status) " 32 "VALUES (:iov_id, :logic_id, " 34 }
catch (SQLException&
e) {
35 throw(std::runtime_error(
"CaliHVScanRatioDat::prepareWrite(): " +
e.getMessage()));
42 this->checkConnection();
45 int iovID = iov->fetchID();
47 throw(std::runtime_error(
"CaliHVScanRatioDat::writeDB: IOV not in DB"));
50 int logicID = ecid->getLogicID();
52 throw(std::runtime_error(
"CaliHVScanRatioDat::writeDB: Bad EcalLogicID"));
56 m_writeStmt->setInt(1, iovID);
57 m_writeStmt->setInt(2, logicID);
59 m_writeStmt->setFloat(3,
item->getHVRatio());
60 m_writeStmt->setFloat(4,
item->getHVRatioRMS());
61 m_writeStmt->setInt(5,
item->getTaskStatus());
63 m_writeStmt->executeUpdate();
64 }
catch (SQLException&
e) {
65 throw(std::runtime_error(
"CaliHVScanRatioDat::writeDB(): " +
e.getMessage()));
70 this->checkConnection();
73 iov->setConnection(m_env, m_conn);
74 int iovID = iov->fetchID();
81 Statement* stmt = m_conn->createStatement();
83 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 84 "d.hvratio, d.hvratio_rms, d.task_status " 85 "FROM channelview cv JOIN cali_hv_scan_ratio_dat d " 86 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 87 "WHERE d.iov_id = :iov_id");
88 stmt->setInt(1, iovID);
89 ResultSet* rset = stmt->executeQuery();
91 std::pair<EcalLogicID, CaliHVScanRatioDat>
p;
93 while (rset->next()) {
108 }
catch (SQLException&
e) {
109 throw(std::runtime_error(
"CaliHVScanRatioDat::fetchData(): " +
e.getMessage()));
void setTaskStatus(bool s)
~CaliHVScanRatioDat() override
void fetchData(std::map< EcalLogicID, CaliHVScanRatioDat > *fillVec, CaliIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
void setHVRatioRMS(float c)
void writeDB(const EcalLogicID *ecid, const CaliHVScanRatioDat *item, CaliIOV *iov) noexcept(false)