13 m_writeStmt =
nullptr;
29 this->checkConnection();
32 m_writeStmt = m_conn->createStatement();
33 m_writeStmt->setSQL(
"INSERT INTO ECAL_LTC_Cycle (cycle_id, ltc_configuration_id ) " 36 throw(std::runtime_error(
std::string(
"ODLTCCycle::prepareWrite(): ")+getOraMessage(&e)));
43 this->checkConnection();
48 m_writeStmt->setInt(1, this->
getId());
49 m_writeStmt->setInt(2, this->getLTCConfigurationID());
51 m_writeStmt->executeUpdate();
55 throw(std::runtime_error(
std::string(
"ODLTCCycle::writeDB: ")+getOraMessage(&e)));
59 if (!this->fetchID()) {
60 throw(std::runtime_error(
"ODLTCCycle::writeDB: Failed to write"));
79 this->checkConnection();
82 Statement* stmt = m_conn->createStatement();
83 stmt->setSQL(
"SELECT cycle_id, ltc_configuration_id FROM ecal_ltc_cycle " 84 "WHERE cycle_id = :1 ");
85 stmt->setInt(1, m_ID);
86 ResultSet* rset = stmt->executeQuery();
89 m_ID = rset->getInt(1);
90 m_ltc_config_id = rset->getInt(2);
94 m_conn->terminateStatement(stmt);
96 throw(std::runtime_error(
std::string(
"ODLTCCycle::fetchID: ")+getOraMessage(&e)));
107 this->checkConnection();
111 Statement* stmt = m_conn->createStatement();
112 stmt->setSQL(
"SELECT cycle_id, ltc_configuration_id FROM ecal_ltc_cycle " 113 "WHERE cycle_id = :1 ");
115 ResultSet* rset = stmt->executeQuery();
118 m_ID = rset->getInt(1);
119 m_ltc_config_id = rset->getInt(2);
123 m_conn->terminateStatement(stmt);
125 throw(std::runtime_error(
std::string(
"ODLTCCycle::fetchID: ")+getOraMessage(&e)));
134 this->checkConnection();
138 throw(std::runtime_error(
"ODLTCConfig::fetchData(): no Id defined for this ODLTCConfig "));
143 m_readStmt->setSQL(
"SELECT ltc_configuration_id FROM ecal_ltc_cycle " 144 "WHERE cycle_id = :1 ");
146 m_readStmt->setInt(1,
result->getId());
147 ResultSet* rset = m_readStmt->executeQuery();
151 result->setLTCConfigurationID( rset->getInt(1) );
154 throw(std::runtime_error(
std::string(
"ODLTCCycle::fetchData(): ")+getOraMessage(&e)));
166 terminateWriteStatement();
167 }
catch (std::runtime_error &
e) {
172 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
void setByID(int id) noexcept(false)
static unsigned int getId()
void insertConfig() noexcept(false)
int fetchID() noexcept(false)
void writeDB() noexcept(false)
void prepareWrite() noexcept(false) override
oracle::occi::Statement Statement
oracle::occi::SQLException SQLException
void fetchData(ODLTCCycle *result) noexcept(false)