28 m_writeStmt =
nullptr;
38 std::cout <<
"ODEcalCycle::prepareWrite(): this is a view writing specific tables " << endl;
43 cyc.
setTag(this->getCycleTag());
50 int cyc_id = cyc.
getId();
51 cout <<
"Cycle inserted with ID " << cyc_id << endl;
54 if (getCCSId() != 0) {
56 ccs_cycle.
setId(cyc_id);
60 cout <<
"Inserting CCS-cycle in DB..." << flush;
62 if (getDCCId() != 0) {
64 dcc_cycle.
setId(cyc_id);
68 cout <<
"Inserting DCC-cycle in DB..." << flush;
70 if (getLaserId() != 0) {
72 laser_cycle.
setId(cyc_id);
76 cout <<
"Inserting LASER-cycle in DB..." << flush;
78 if (getLTCId() != 0) {
80 ltc_cycle.
setId(cyc_id);
84 cout <<
"Inserting LTC-cycle in DB..." << flush;
86 if (getLTSId() != 0) {
88 lts_cycle.
setId(cyc_id);
92 cout <<
"Inserting LTS-cycle in DB..." << flush;
94 if (getDCUId() != 0) {
96 dcu_cycle.
setId(cyc_id);
100 cout <<
"Inserting DCU-cycle in DB..." << flush;
102 if (getTCCId() != 0) {
104 tcc_cycle.
setId(cyc_id);
108 cout <<
"Inserting TCC-cycle in DB..." << flush;
110 if (getTCCEEId() != 0) {
112 tcc_ee_cycle.
setId(cyc_id);
116 cout <<
"Inserting TCCEE-cycle in DB..." << flush;
118 if (getTTCCIId() != 0) {
120 ttcci_cycle.
setId(cyc_id);
124 cout <<
"Inserting TTCCI-cycle in DB..." << flush;
126 if (getTTCFId() != 0) {
128 ttcf_cycle.
setId(cyc_id);
132 cout <<
"Inserting TTCF-cycle in DB..." << flush;
134 if (getSRPId() != 0) {
136 srp_cycle.
setId(cyc_id);
140 cout <<
"Inserting SRP-cycle in DB..." << flush;
142 if (getJBH4Id() != 0) {
144 jbh4_cycle.
setId(cyc_id);
148 cout <<
"Inserting JBH4-cycle in DB..." << flush;
150 if (getScanId() != 0) {
152 scan_cycle.
setId(cyc_id);
156 cout <<
"Inserting SCAN-cycle in DB..." << flush;
166 m_cycle_description =
"";
189 this->checkConnection();
194 Statement* stmt = m_conn->createStatement();
196 "SELECT cycle_id from ECAL_CYCLE_DAT "
197 "WHERE sequence_id = :1 ");
198 stmt->setInt(1, m_seq_id);
200 ResultSet* rset = stmt->executeQuery();
203 m_ID = rset->getInt(1);
207 m_conn->terminateStatement(stmt);
209 throw(std::runtime_error(
"ODEcalCycle::fetchID: " +
e.getMessage()));
216 this->checkConnection();
221 Statement* stmt = m_conn->createStatement();
224 "SELECT tag, version, sequence_num, cycle_num, cycle_tag, description, "
225 "ccs_configuration_id, dcc_configuration_id, laser_configuration_id, "
226 "ltc_configuration_id, lts_configuration_id, tcc_configuration_id, "
227 "\"TTCci_CONFIGURATION_ID\", jbh4_configuration_id, scan_id, TTCF_configuration_id, "
228 "srp_configuration_id, dcu_configuration_id, tcc_ee_configuration_id "
229 "FROM ECAL_CYCLE where cycle_id = :1 ");
232 ResultSet* rset = stmt->executeQuery();
234 m_tag = rset->getString(1);
235 m_version = rset->getInt(2);
236 m_seq_num = rset->getInt(3);
237 m_cycle_num = rset->getInt(4);
238 m_cycle_tag = rset->getString(5);
239 m_cycle_description = rset->getString(6);
240 m_ccs = rset->getInt(7);
241 m_dcc = rset->getInt(8);
242 m_laser = rset->getInt(9);
243 m_ltc = rset->getInt(10);
244 m_lts = rset->getInt(11);
245 m_tcc = rset->getInt(12);
246 m_ttcci = rset->getInt(13);
247 m_jbh4 = rset->getInt(14);
248 m_scan = rset->getInt(15);
249 m_ttcf = rset->getInt(16);
250 m_srp = rset->getInt(17);
251 m_dcu = rset->getInt(18);
252 m_tcc_ee = rset->getInt(19);
255 throw(std::runtime_error(
"ODEcalCycle::setByID: Given config_id is not in the database"));
257 m_conn->terminateStatement(stmt);
259 throw(std::runtime_error(
"ODEcalCycle::setByID: " +
e.getMessage()));
264 std::cout <<
"**** ODEcalCycle ****" << std::endl;
265 std::cout <<
"**** id: " << m_ID << std::endl;
266 std::cout <<
"**** tag: " << m_tag << std::endl;
267 std::cout <<
"**** version: " << m_version << std::endl;
268 std::cout <<
"**** seq_num: " << m_seq_num << std::endl;
269 std::cout <<
"**** cycle num: " << m_cycle_num << std::endl;
270 std::cout <<
"**** cycle tag: " << m_cycle_tag << std::endl;
271 std::cout <<
"**** cycle description: " << m_cycle_description << std::endl;
272 std::cout <<
"**** ccs_id: " << m_ccs << std::endl;
273 std::cout <<
"**** dcc_id: " << m_dcc << std::endl;
274 std::cout <<
"**** laser: " << m_laser << std::endl;
275 std::cout <<
"**** ttcf_id: " << m_ttcf << std::endl;
276 std::cout <<
"**** srp_id: " << m_srp << std::endl;
277 std::cout <<
"**** scan_id: " << m_scan << std::endl;
278 std::cout <<
"**** ODEcalCycle ****" << std::endl;
282 this->checkConnection();
284 if (
result->getId() == 0) {
291 "SELECT tag, version, sequence_num, cycle_num, cycle_tag, description, "
292 "ccs_configuration_id, dcc_configuration_id, laser_configuration_id, "
293 "ltc_configuration_id, lts_configuration_id, tcc_configuration_id, "
294 "\"TTCci_CONFIGURATION_ID\", jbh4_configuration_id, scan_id, TTCF_configuration_id, "
295 "srp_configuration_id, dcu_configuration_id, tcc_ee_configuration_id "
296 "FROM ECAL_CYCLE where cycle_id = :1 ");
297 m_readStmt->setInt(1,
result->getId());
298 ResultSet* rset = m_readStmt->executeQuery();
302 result->setTag(rset->getString(1));
303 result->setVersion(rset->getInt(2));
304 result->setSeqNum(rset->getInt(3));
305 result->setCycleNum(rset->getInt(4));
306 result->setCycleTag(rset->getString(5));
307 result->setCycleDescription(rset->getString(6));
308 result->setCCSId(rset->getInt(7));
309 result->setDCCId(rset->getInt(8));
310 result->setLaserId(rset->getInt(9));
311 result->setLTCId(rset->getInt(10));
312 result->setLTSId(rset->getInt(11));
313 result->setTCCId(rset->getInt(12));
314 result->setTTCCIId(rset->getInt(13));
316 result->setJBH4Id(rset->getInt(14));
317 result->setScanId(rset->getInt(15));
319 result->setTTCFId(rset->getInt(16));
320 result->setSRPId(rset->getInt(17));
321 result->setDCUId(rset->getInt(18));
322 result->setTCCEEId(rset->getInt(19));
325 throw(std::runtime_error(
"ODEcalCycle::fetchData(): " +
e.getMessage()));