16 m_writeStmt =
nullptr;
33 this->checkConnection();
36 m_writeStmt = m_conn->createStatement();
37 m_writeStmt->setSQL(
"INSERT INTO cali_general_dat (iov_id, logic_id, " 38 "num_events, comments) " 39 "VALUES (:iov_id, :logic_id, " 41 }
catch (SQLException &
e) {
42 throw(std::runtime_error(
"CaliGeneralDat::prepareWrite(): "+e.getMessage()));
51 this->checkConnection();
54 int iovID = iov->fetchID();
55 if (!iovID) {
throw(std::runtime_error(
"CaliGeneralDat::writeDB: IOV not in DB")); }
57 int logicID = ecid->getLogicID();
58 if (!logicID) {
throw(std::runtime_error(
"CaliGeneralDat::writeDB: Bad EcalLogicID")); }
61 m_writeStmt->setInt(1, iovID);
62 m_writeStmt->setInt(2, logicID);
64 m_writeStmt->setInt(3, item->getNumEvents() );
65 m_writeStmt->setString(4, item->getComments() );
67 m_writeStmt->executeUpdate();
68 }
catch (SQLException &
e) {
69 throw(std::runtime_error(
"CaliGeneralDat::writeDB(): "+e.getMessage()));
78 this->checkConnection();
81 iov->setConnection(m_env, m_conn);
82 int iovID = iov->fetchID();
90 m_readStmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, " 91 "d.num_events, d.comments " 92 "FROM channelview cv JOIN cali_general_dat d " 93 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to " 94 "WHERE d.iov_id = :iov_id");
95 m_readStmt->setInt(1, iovID);
96 ResultSet* rset = m_readStmt->executeQuery();
98 std::pair< EcalLogicID, CaliGeneralDat >
p;
100 while(rset->next()) {
114 }
catch (SQLException &
e) {
115 throw(std::runtime_error(
"CaliGeneralDat::fetchData(): "+e.getMessage()));
void fetchData(std::map< EcalLogicID, CaliGeneralDat > *fillVec, CaliIOV *iov) noexcept(false)
void prepareWrite() noexcept(false) override
void writeDB(const EcalLogicID *ecid, const CaliGeneralDat *item, CaliIOV *iov) noexcept(false)
void setComments(std::string comments)
~CaliGeneralDat() override