16 m_writeStmt =
nullptr;
34 this->checkConnection();
37 m_writeStmt = m_conn->createStatement();
38 m_writeStmt->setSQL(
"INSERT INTO cali_hv_scan_ratio_dat (iov_id, logic_id, " 39 "hvratio, hvratio_rms, task_status) " 40 "VALUES (:iov_id, :logic_id, " 42 }
catch (SQLException &
e) {
43 throw(std::runtime_error(
"CaliHVScanRatioDat::prepareWrite(): "+e.getMessage()));
52 this->checkConnection();
55 int iovID = iov->fetchID();
56 if (!iovID) {
throw(std::runtime_error(
"CaliHVScanRatioDat::writeDB: IOV not in DB")); }
58 int logicID = ecid->getLogicID();
59 if (!logicID) {
throw(std::runtime_error(
"CaliHVScanRatioDat::writeDB: Bad EcalLogicID")); }
62 m_writeStmt->setInt(1, iovID);
63 m_writeStmt->setInt(2, logicID);
65 m_writeStmt->setFloat(3, item->getHVRatio() );
66 m_writeStmt->setFloat(4, item->getHVRatioRMS() );
67 m_writeStmt->setInt(5, item->getTaskStatus() );
69 m_writeStmt->executeUpdate();
70 }
catch (SQLException &
e) {
71 throw(std::runtime_error(
"CaliHVScanRatioDat::writeDB(): "+e.getMessage()));
80 this->checkConnection();
83 iov->setConnection(m_env, m_conn);
84 int iovID = iov->fetchID();
91 Statement* stmt = m_conn->createStatement();
92 stmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 93 "d.hvratio, d.hvratio_rms, d.task_status " 94 "FROM channelview cv JOIN cali_hv_scan_ratio_dat d " 95 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 96 "WHERE d.iov_id = :iov_id");
97 stmt->setInt(1, iovID);
98 ResultSet* rset = stmt->executeQuery();
100 std::pair< EcalLogicID, CaliHVScanRatioDat >
p;
102 while(rset->next()) {
117 }
catch (SQLException &
e) {
118 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)