20 m_writeStmt =
nullptr;
37 this->checkConnection();
40 m_writeStmt = m_conn->createStatement();
41 m_writeStmt->setSQL(
"INSERT INTO run_comment_dat (iov_id, " 42 "source, user_comment) " 44 ":source, :user_comment)");
45 }
catch (SQLException &
e) {
46 throw(std::runtime_error(
"RunCommentDat::prepareWrite(): "+e.getMessage()));
55 this->checkConnection();
58 int iovID = iov->fetchID();
59 if (!iovID) {
throw(std::runtime_error(
"RunCommentDat::writeDB: IOV not in DB")); }
62 m_writeStmt->setInt(1, iovID);
63 m_writeStmt->setString(2, item->getSource());
64 m_writeStmt->setString(3, item->getComment());
66 m_writeStmt->executeUpdate();
67 }
catch (SQLException &
e) {
68 throw(std::runtime_error(
"RunCommentDat::writeDB(): "+e.getMessage()));
77 this->checkConnection();
82 iov->setConnection(m_env, m_conn);
83 int iovID = iov->fetchID();
90 Statement* stmt = m_conn->createStatement();
91 stmt->setSQL(
"SELECT d.comment_id, " 92 "d.source, d.user_comment, d.db_timestamp " 93 "FROM run_comment_dat d " 94 "WHERE d.iov_id = :iov_id order by d.logic_id ");
95 stmt->setInt(1, iovID);
96 ResultSet* rset = stmt->executeQuery();
98 std::pair< EcalLogicID, RunCommentDat >
p;
100 while(rset->next()) {
102 rset->getInt(1), rset->getInt(1),
109 Date startDate = rset->getDate(4);
115 m_conn->terminateStatement(stmt);
116 }
catch (SQLException &
e) {
117 throw(std::runtime_error(
"RunCommentDat::fetchData(): "+e.getMessage()));
Tm dateToTm(oracle::occi::Date &date) const