7 using namespace oracle::occi;
27 throw(std::runtime_error)
29 this->checkConnection();
32 m_writeStmt = m_conn->createStatement();
33 m_writeStmt->setSQL(
"INSERT INTO ECAL_TTCF_Cycle (cycle_id, ttcf_configuration_id ) "
36 throw(std::runtime_error(
"ODTTCFCycle::prepareWrite(): "+e.getMessage()));
43 this->checkConnection();
48 m_writeStmt->setInt(1, this->
getId());
49 m_writeStmt->setInt(2, this->getTTCFConfigurationID());
51 m_writeStmt->executeUpdate();
55 throw(std::runtime_error(
"ODTTCFCycle::writeDB: "+e.getMessage()));
59 if (!this->fetchID()) {
60 throw(std::runtime_error(
"ODTTCFCycle::writeDB: Failed to write"));
72 throw(std::runtime_error)
79 this->checkConnection();
82 Statement* stmt = m_conn->createStatement();
83 stmt->setSQL(
"SELECT cycle_id, ttcf_configuration_id FROM ecal_ttcf_cycle "
84 "WHERE cycle_id = :1 ");
85 stmt->setInt(1, m_ID);
89 m_ID = rset->getInt(1);
90 m_ttcf_config_id = rset->getInt(2);
94 m_conn->terminateStatement(stmt);
96 throw(std::runtime_error(
"ODTTCFCycle::fetchID: "+e.getMessage()));
105 throw(std::runtime_error)
107 this->checkConnection();
111 Statement* stmt = m_conn->createStatement();
112 stmt->setSQL(
"SELECT cycle_id, ttcf_configuration_id FROM ecal_ttcf_cycle "
113 "WHERE cycle_id = :1 ");
118 m_ID = rset->getInt(1);
119 m_ttcf_config_id = rset->getInt(2);
123 m_conn->terminateStatement(stmt);
125 throw(std::runtime_error(
"ODTTCFCycle::fetchID: "+e.getMessage()));
132 throw(std::runtime_error)
134 this->checkConnection();
138 throw(std::runtime_error(
"ODTTCFConfig::fetchData(): no Id defined for this ODTTCFConfig "));
143 m_readStmt->setSQL(
"SELECT ttcf_configuration_id FROM ecal_ttcf_cycle "
144 "WHERE cycle_id = :1 ");
146 m_readStmt->setInt(1,
result->getId());
147 ResultSet* rset = m_readStmt->executeQuery();
151 result->setTTCFConfigurationID( rset->getInt(1) );
154 throw(std::runtime_error(
"ODTTCFCycle::fetchData(): "+e.getMessage()));
159 throw(std::runtime_error)
166 terminateWriteStatement();
167 }
catch (std::runtime_error &
e) {
172 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
static unsigned int getId(void)
oracle::occi::Statement Statement
void fetchData(ODTTCFCycle *result)
oracle::occi::ResultSet ResultSet
oracle::occi::SQLException SQLException