7 using namespace oracle::occi;
12 m_writeStmt =
nullptr;
16 m_tcc_ee_config_id = 0;
22 this->checkConnection();
25 m_writeStmt = m_conn->createStatement();
27 "INSERT INTO ECAL_TCC_EE_Cycle (cycle_id, tcc_ee_configuration_id ) "
30 throw(std::runtime_error(
"ODTCCEECycle::prepareWrite(): " + e.getMessage()));
35 this->checkConnection();
39 m_writeStmt->setInt(1, this->
getId());
40 m_writeStmt->setInt(2, this->getTCCConfigurationID());
42 m_writeStmt->executeUpdate();
45 throw(std::runtime_error(
"ODTCCEECycle::writeDB: " + e.getMessage()));
49 if (!this->fetchID()) {
50 throw(std::runtime_error(
"ODTCCEECycle::writeDB: Failed to write"));
62 this->checkConnection();
65 Statement *stmt = m_conn->createStatement();
67 "SELECT cycle_id, tcc_ee_configuration_id FROM ecal_tcc_ee_cycle "
68 "WHERE cycle_id = :1 ");
69 stmt->setInt(1, m_ID);
70 ResultSet *rset = stmt->executeQuery();
73 m_ID = rset->getInt(1);
74 m_tcc_ee_config_id = rset->getInt(2);
78 m_conn->terminateStatement(stmt);
80 throw(std::runtime_error(
"ODTCCEECycle::fetchID: " + e.getMessage()));
87 this->checkConnection();
90 Statement *stmt = m_conn->createStatement();
92 "SELECT cycle_id, tcc_ee_configuration_id FROM ecal_tcc_ee_cycle "
93 "WHERE cycle_id = :1 ");
95 ResultSet *rset = stmt->executeQuery();
98 m_ID = rset->getInt(1);
99 m_tcc_ee_config_id = rset->getInt(2);
103 m_conn->terminateStatement(stmt);
105 throw(std::runtime_error(
"ODTCCEECycle::fetchID: " + e.getMessage()));
110 this->checkConnection();
113 if (
result->getId() == 0) {
114 throw(std::runtime_error(
"ODTCCConfig::fetchData(): no Id defined for this ODTCCConfig "));
119 "SELECT tcc_ee_configuration_id FROM ecal_tcc_ee_cycle "
120 "WHERE cycle_id = :1 ");
122 m_readStmt->setInt(1,
result->getId());
123 ResultSet *rset = m_readStmt->executeQuery();
127 result->setTCCConfigurationID(rset->getInt(1));
130 throw(std::runtime_error(
"ODTCCEECycle::fetchData(): " + e.getMessage()));
139 terminateWriteStatement();
140 }
catch (std::runtime_error &
e) {
145 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
static unsigned int getId()
void setByID(int id) noexcept(false)
void writeDB() noexcept(false)
void prepareWrite() noexcept(false) override
void insertConfig() noexcept(false)
int fetchID() noexcept(false)
oracle::occi::Statement Statement
void fetchData(ODTCCEECycle *result) noexcept(false)
oracle::occi::SQLException SQLException