15 m_writeStmt =
nullptr;
26 this->checkConnection();
29 m_writeStmt = m_conn->createStatement();
31 "INSERT INTO dcu_lvr_temps_dat (iov_id, logic_id, "
33 "VALUES (:iov_id, :logic_id, "
35 }
catch (SQLException&
e) {
36 throw(std::runtime_error(
"DCULVRTempsDat::prepareWrite(): " +
e.getMessage()));
41 this->checkConnection();
44 int iovID = iov->fetchID();
46 throw(std::runtime_error(
"DCULVRTempsDat::writeDB: IOV not in DB"));
49 int logicID = ecid->getLogicID();
51 throw(std::runtime_error(
"DCULVRTempsDat::writeDB: Bad EcalLogicID"));
55 m_writeStmt->setInt(1, iovID);
56 m_writeStmt->setInt(2, logicID);
58 m_writeStmt->setFloat(3,
item->getT1());
59 m_writeStmt->setFloat(4,
item->getT2());
60 m_writeStmt->setFloat(5,
item->getT3());
62 m_writeStmt->executeUpdate();
63 }
catch (SQLException&
e) {
64 throw(std::runtime_error(
"DCULVRTempsDat::writeDB(): " +
e.getMessage()));
69 this->checkConnection();
72 iov->setConnection(m_env, m_conn);
73 int iovID = iov->fetchID();
81 "SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
83 "FROM channelview cv JOIN dcu_lvr_temps_dat d "
84 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
85 "WHERE d.iov_id = :iov_id");
86 m_readStmt->setInt(1, iovID);
87 ResultSet* rset = m_readStmt->executeQuery();
89 std::pair<EcalLogicID, DCULVRTempsDat>
p;
91 while (rset->next()) {
99 dat.
setT1(rset->getFloat(7));
100 dat.
setT2(rset->getFloat(8));
101 dat.
setT3(rset->getFloat(9));
106 }
catch (SQLException&
e) {
107 throw(std::runtime_error(
"DCULVRTempsDat::fetchData(): " +
e.getMessage()));