4 #include <boost/lexical_cast.hpp>
10 using namespace oracle::occi;
29 throw(std::runtime_error)
31 this->checkConnection();
34 m_writeStmt = m_conn->createStatement();
36 m_writeStmt->setSQL(
"INSERT INTO run_crystal_errors_dat (iov_id, logic_id, "
38 "VALUES (:iov_id, :logic_id, "
39 "to_number(:error_bits))");
41 throw(std::runtime_error(
"RunCrystalErrorsDat::prepareWrite(): "+e.getMessage()));
48 throw(std::runtime_error)
50 this->checkConnection();
53 int iovID =
iov->fetchID();
54 if (!iovID) {
throw(std::runtime_error(
"RunCrystalErrorsDat::writeDB: IOV not in DB")); }
56 int logicID = ecid->getLogicID();
57 if (!logicID) {
throw(std::runtime_error(
"RunCrystalErrorsDat::writeDB: Bad EcalLogicID")); }
60 m_writeStmt->setInt(1, iovID);
61 m_writeStmt->setInt(2, logicID);
62 m_writeStmt->setString(3, ( boost::lexical_cast<std::string>(item->getErrorBits()) ).c_str());
63 m_writeStmt->executeUpdate();
65 throw(std::runtime_error(
"RunCrystalErrorsDat::writeDB(): "+e.getMessage()));
72 throw(std::runtime_error)
74 this->checkConnection();
77 iov->setConnection(m_env, m_conn);
78 int iovID =
iov->fetchID();
85 Statement* stmt = m_conn->createStatement();
87 stmt->setSQL(
"SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
88 "to_char(d.error_bits) "
89 "FROM channelview cv JOIN run_crystal_errors_dat d "
90 "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
91 "WHERE d.iov_id = :iov_id");
92 stmt->setInt(1, iovID);
95 std::pair< EcalLogicID, RunCrystalErrorsDat >
p;
105 dat.
setErrorBits( boost::lexical_cast<uint64_t>(rset->getString(7)) );
110 m_conn->terminateStatement(stmt);
113 throw(std::runtime_error(
"RunCrystalErrorsDat::fetchData(): "+e.getMessage()));
void writeDB(const EcalLogicID *ecid, const RunCrystalErrorsDat *item, RunIOV *iov)
void fetchData(std::map< EcalLogicID, RunCrystalErrorsDat > *fillMap, RunIOV *iov)
oracle::occi::SQLException SQLException
void setErrorBits(uint64_t bits)
oracle::occi::ResultSet ResultSet