43 this->checkConnection();
46 m_writeStmt = m_conn->createStatement();
47 m_writeStmt->setSQL(
"INSERT INTO ECAL_CYCLE_DAT ( sequence_id , cycle_num, tag, description ) " 48 "VALUES (:1, :2, :3 , :4 )");
51 throw(std::runtime_error(
"ODRunConfigCycleInfo::prepareWrite(): "+e.getMessage()));
59 this->checkConnection();
67 m_writeStmt->setInt(1, this->getSequenceID());
68 m_writeStmt->setInt(2, this->getCycleNumber());
69 m_writeStmt->setString(3, this->getTag());
70 m_writeStmt->setString(4, this->getDescription());
71 m_writeStmt->executeUpdate();
76 throw(std::runtime_error(
"ODRunConfigCycleInfo::writeDB: "+e.getMessage()));
79 if (!this->fetchID()) {
80 throw(std::runtime_error(
"ODRunConfigCycleInfo::writeDB: Failed to write"));
83 cout<<
"ODRunConfigCycleInfo::writeDB>> done inserting ODRunConfigCycleInfo with id="<<m_ID<<endl;
100 this->checkConnection();
106 Statement* stmt = m_conn->createStatement();
107 stmt->setSQL(
"SELECT cycle_id from ECAL_cycle_DAT " 108 "WHERE sequence_id = :id1 " 109 " and cycle_num = :id2 " );
110 stmt->setInt(1, m_sequence_id);
111 stmt->setInt(2, m_cycle_num);
113 ResultSet* rset = stmt->executeQuery();
116 m_ID = rset->getInt(1);
120 m_conn->terminateStatement(stmt);
122 throw(std::runtime_error(
"ODRunConfigCycleInfo::fetchID: "+e.getMessage()));
135 this->checkConnection();
140 Statement* stmt = m_conn->createStatement();
141 stmt->setSQL(
"SELECT max(cycle_id) FROM ecal_cycle_dat " );
142 ResultSet* rset = stmt->executeQuery();
145 m_ID = rset->getInt(1);
149 m_conn->terminateStatement(stmt);
151 throw(std::runtime_error(
"ODRunConfigCycleInfo::fetchIDLast: "+e.getMessage()));
162 this->checkConnection();
166 cout<<
"ODRunConfigCycleInfo::setByID called for id "<<
id<<endl;
169 Statement* stmt = m_conn->createStatement();
171 stmt->setSQL(
"SELECT sequence_id , cycle_num , tag , description FROM ECAL_cycle_DAT WHERE cycle_id = :1 ");
174 ResultSet* rset = stmt->executeQuery();
176 m_sequence_id=rset->getInt(1);
177 m_cycle_num=rset->getInt(2);
178 m_tag = rset->getString(3);
179 m_description= rset->getString(4);
182 throw(std::runtime_error(
"ODRunConfigCycleInfo::setByID: Given cycle_id is not in the database"));
184 m_conn->terminateStatement(stmt);
186 throw(std::runtime_error(
"ODRunConfigCycleInfo::setByID: "+e.getMessage()));
194 this->checkConnection();
197 throw(std::runtime_error(
"ODRunConfigCycleInfo::fetchData(): no Id defined for this ODRunConfigCycleInfo "));
201 m_readStmt->setSQL(
"SELECT sequence_id , cycle_num , tag , description FROM ECAL_cycle_DAT WHERE cycle_id = :1 ");
203 m_readStmt->setInt(1,
result->getId());
204 ResultSet* rset = m_readStmt->executeQuery();
208 result->setSequenceID( rset->getInt(1) );
209 result->setCycleNumber( rset->getInt(2) );
210 result->setTag( rset->getString(3) );
211 result->setDescription( rset->getString(4) );
214 throw(std::runtime_error(
"ODRunConfigCycleInfo::fetchData(): "+e.getMessage()));
226 terminateWriteStatement();
227 }
catch (std::runtime_error &
e) {
232 throw(std::runtime_error(
"EcalCondDBInterface::insertDataSet: Unknown exception caught"));
void prepareWrite() noexcept(false)
void writeDB() noexcept(false)
oracle::occi::Statement Statement
int fetchIDLast() noexcept(false)
void setByID(int id) noexcept(false)
void insertConfig() noexcept(false)
void fetchData(ODRunConfigCycleInfo *result) noexcept(false)
int fetchID() noexcept(false)
oracle::occi::SQLException SQLException