23 using namespace oracle::occi;
45 throw(std::runtime_error)
48 std::cout<<
"ODEcalCycle::prepareWrite(): this is a view writing specific tables "<< endl;
55 throw(std::runtime_error)
59 cyc.
setTag(this->getCycleTag());
66 int cyc_id=cyc.
getId();
67 cout <<
"Cycle inserted with ID "<< cyc_id<< endl;
72 ccs_cycle.
setId(cyc_id);
76 cout <<
"Inserting CCS-cycle in DB..." << flush;
80 dcc_cycle.
setId(cyc_id);
84 cout <<
"Inserting DCC-cycle in DB..." << flush;
88 laser_cycle.
setId(cyc_id);
92 cout <<
"Inserting LASER-cycle in DB..." << flush;
96 ltc_cycle.
setId(cyc_id);
100 cout <<
"Inserting LTC-cycle in DB..." << flush;
104 lts_cycle.
setId(cyc_id);
108 cout <<
"Inserting LTS-cycle in DB..." << flush;
112 dcu_cycle.
setId(cyc_id);
116 cout <<
"Inserting DCU-cycle in DB..." << flush;
120 tcc_cycle.
setId(cyc_id);
124 cout <<
"Inserting TCC-cycle in DB..." << flush;
128 tcc_ee_cycle.
setId(cyc_id);
132 cout <<
"Inserting TCCEE-cycle in DB..." << flush;
136 ttcci_cycle.
setId(cyc_id);
140 cout <<
"Inserting TTCCI-cycle in DB..." << flush;
144 ttcf_cycle.
setId(cyc_id);
148 cout <<
"Inserting TTCF-cycle in DB..." << flush;
152 srp_cycle.
setId(cyc_id);
156 cout <<
"Inserting SRP-cycle in DB..." << flush;
160 jbh4_cycle.
setId(cyc_id);
164 cout <<
"Inserting JBH4-cycle in DB..." << flush;
168 scan_cycle.
setId(cyc_id);
172 cout <<
"Inserting SCAN-cycle in DB..." << flush;
185 m_cycle_description=
"";
203 throw(std::runtime_error)
210 this->checkConnection();
216 Statement* stmt = m_conn->createStatement();
217 stmt->setSQL(
"SELECT cycle_id from ECAL_CYCLE_DAT "
218 "WHERE sequence_id = :1 ");
219 stmt->setInt(1, m_seq_id);
224 m_ID = rset->getInt(1);
228 m_conn->terminateStatement(stmt);
230 throw(std::runtime_error(
"ODEcalCycle::fetchID: "+e.getMessage()));
237 throw(std::runtime_error)
239 this->checkConnection();
244 Statement* stmt = m_conn->createStatement();
246 stmt->setSQL(
"SELECT tag, version, sequence_num, cycle_num, cycle_tag, description, "
247 "ccs_configuration_id, dcc_configuration_id, laser_configuration_id, "
248 "ltc_configuration_id, lts_configuration_id, tcc_configuration_id, "
249 "\"TTCci_CONFIGURATION_ID\", jbh4_configuration_id, scan_id, TTCF_configuration_id, "
250 "srp_configuration_id, dcu_configuration_id, tcc_ee_configuration_id "
251 "FROM ECAL_CYCLE where cycle_id = :1 " );
256 m_tag = rset->getString(1);
257 m_version = rset->getInt(2);
258 m_seq_num = rset->getInt(3);
259 m_cycle_num = rset->getInt(4);
260 m_cycle_tag = rset->getString(5);
261 m_cycle_description = rset->getString(6);
262 m_ccs = rset->getInt(7);
263 m_dcc = rset->getInt(8);
264 m_laser = rset->getInt(9);
265 m_ltc = rset->getInt(10);
266 m_lts = rset->getInt(11);
267 m_tcc = rset->getInt(12);
268 m_ttcci = rset->getInt(13);
269 m_jbh4 = rset->getInt(14);
270 m_scan = rset->getInt(15);
271 m_ttcf = rset->getInt(16);
272 m_srp = rset->getInt(17);
273 m_dcu = rset->getInt(18);
274 m_tcc_ee = rset->getInt(19);
277 throw(std::runtime_error(
"ODEcalCycle::setByID: Given config_id is not in the database"));
279 m_conn->terminateStatement(stmt);
281 throw(std::runtime_error(
"ODEcalCycle::setByID: "+e.getMessage()));
288 std::cout <<
"**** ODEcalCycle ****"<< std::endl;
289 std::cout <<
"**** id: "<< m_ID << std::endl;
290 std::cout <<
"**** tag: "<< m_tag << std::endl;
291 std::cout <<
"**** version: "<< m_version << std::endl;
292 std::cout <<
"**** seq_num: "<< m_seq_num << std::endl;
293 std::cout <<
"**** cycle num: "<< m_cycle_num << std::endl;
294 std::cout <<
"**** cycle tag: "<< m_cycle_tag << std::endl;
295 std::cout <<
"**** cycle description: "<< m_cycle_description<< std::endl;
296 std::cout <<
"**** ccs_id: "<< m_ccs <<std::endl;
297 std::cout <<
"**** dcc_id: "<< m_dcc <<std::endl;
298 std::cout <<
"**** laser: "<< m_laser << std::endl;
299 std::cout <<
"**** ttcf_id: "<< m_ttcf << std::endl;
300 std::cout <<
"**** srp_id: "<< m_srp << std::endl;
301 std::cout <<
"**** scan_id: "<< m_scan << std::endl;
302 std::cout <<
"**** ODEcalCycle ****"<< std::endl;
309 throw(std::runtime_error)
311 this->checkConnection();
320 m_readStmt->setSQL(
"SELECT tag, version, sequence_num, cycle_num, cycle_tag, description, "
321 "ccs_configuration_id, dcc_configuration_id, laser_configuration_id, "
322 "ltc_configuration_id, lts_configuration_id, tcc_configuration_id, "
323 "\"TTCci_CONFIGURATION_ID\", jbh4_configuration_id, scan_id, TTCF_configuration_id, "
324 "srp_configuration_id, dcu_configuration_id, tcc_ee_configuration_id "
325 "FROM ECAL_CYCLE where cycle_id = :1 " );
326 m_readStmt->setInt(1,
result->getId());
327 ResultSet* rset = m_readStmt->executeQuery();
331 result->setTag( rset->getString(1) );
332 result->setVersion( rset->getInt(2) );
333 result->setSeqNum( rset->getInt(3) );
334 result->setCycleNum( rset->getInt(4) );
335 result->setCycleTag( rset->getString(5) );
336 result->setCycleDescription( rset->getString(6) );
337 result->setCCSId( rset->getInt(7) );
338 result->setDCCId( rset->getInt(8) );
339 result->setLaserId( rset->getInt(9) );
340 result->setLTCId( rset->getInt(10) );
341 result->setLTSId( rset->getInt(11) );
342 result->setTCCId( rset->getInt(12) );
343 result->setTTCCIId( rset->getInt(13) );
346 result->setJBH4Id( rset->getInt(14) );
347 result->setScanId( rset->getInt(15) );
349 result->setTTCFId( rset->getInt(16) );
350 result->setSRPId( rset->getInt(17) );
351 result->setDCUId( rset->getInt(18) );
352 result->setTCCEEId( rset->getInt(19) );
355 throw(std::runtime_error(
"ODEcalCycle::fetchData(): "+e.getMessage()));
void fetchData(ODEcalCycle *result)
void setCycleNumber(int n)
void setDescription(std::string x)
void setJBH4ConfigurationID(int x)
void setLTCConfigurationID(int x)
void setSequenceID(int x)
void setDCCConfigurationID(int x)
void setTCCConfigurationID(int x)
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
void setTTCFConfigurationID(int x)
void setTCCConfigurationID(int x)
oracle::occi::Statement Statement
void setTag(std::string x)
oracle::occi::ResultSet ResultSet
void setDCUConfigurationID(int x)
void setLTSConfigurationID(int x)
oracle::occi::SQLException SQLException
void setSRPConfigurationID(int x)
void setCCSConfigurationID(int x)
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
void setScanConfigurationID(int x)
void setTTCciConfigurationID(int x)
void setLaserConfigurationID(int x)