#include <ODRunConfigSeqInfo.h>
Public Member Functions | |
std::string | getDescription () const |
int | getEcalConfigId () const |
int | getId () const |
int | getNumberOfCycles () const |
RunSeqDef | getRunSeqDef () const |
int | getSequenceId () const |
int | getSequenceNumber () const |
std::string | getTable () |
ODRunConfigSeqInfo () | |
bool | operator!= (const ODRunConfigSeqInfo &r) const |
bool | operator== (const ODRunConfigSeqInfo &r) const |
void | setDescription (std::string x) |
void | setEcalConfigId (int x) |
void | setId (int id) |
void | setNumberOfCycles (int x) |
void | setRunSeqDef (const RunSeqDef runSeqDef) |
void | setSequenceId (int x) |
void | setSequenceNumber (int x) |
~ODRunConfigSeqInfo () | |
Private Member Functions | |
void | clear () |
void | fetchData (ODRunConfigSeqInfo *result) throw (std::runtime_error) |
int | fetchID () throw (std::runtime_error) |
int | fetchIDLast () throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | setByID (int id) throw (std::runtime_error) |
void | writeDB () throw (std::runtime_error) |
Private Attributes | |
int | m_cycles |
std::string | m_description |
int | m_ecal_config_id |
int | m_ID |
RunSeqDef | m_run_seq |
int | m_seq_num |
int | m_sequence_id |
Friends | |
class | EcalCondDBInterface |
Definition at line 15 of file ODRunConfigSeqInfo.h.
ODRunConfigSeqInfo::ODRunConfigSeqInfo | ( | ) |
Definition at line 12 of file ODRunConfigSeqInfo.cc.
References NULL.
{ m_env = NULL; m_conn = NULL; m_writeStmt = NULL; m_readStmt = NULL; m_ID = 0; // m_ecal_config_id =0; m_seq_num =0; m_cycles =0; m_run_seq = RunSeqDef(); m_description=""; }
ODRunConfigSeqInfo::~ODRunConfigSeqInfo | ( | ) |
Definition at line 28 of file ODRunConfigSeqInfo.cc.
{}
void ODRunConfigSeqInfo::clear | ( | void | ) | [private] |
Definition at line 197 of file ODRunConfigSeqInfo.cc.
{ // m_ecal_config_id =0; // m_seq_num =0; m_ID =0; m_cycles =0; m_run_seq = RunSeqDef(); m_description=""; }
void ODRunConfigSeqInfo::fetchData | ( | ODRunConfigSeqInfo * | result | ) | throw (std::runtime_error) [private] |
Definition at line 207 of file ODRunConfigSeqInfo.cc.
References alignCSCRings::e, and query::result.
{ this->checkConnection(); // result->clear(); if(result->getId()==0){ // throw(std::runtime_error("ODRunConfigSeqInfo::fetchData(): no Id defined for this record ")); result->fetchID(); } try { m_readStmt->setSQL("SELECT ecal_config_id, sequence_num, num_of_cycles, " "sequence_type_def_id, description FROM ECAL_sequence_DAT WHERE sequence_id = :1 "); m_readStmt->setInt(1, result->getId()); ResultSet* rset = m_readStmt->executeQuery(); rset->next(); result->setEcalConfigId( rset->getInt(1) ); result->setSequenceNumber( rset->getInt(2) ); result->setNumberOfCycles( rset->getInt(3) ); int seq_def_id=rset->getInt(4); m_run_seq.setConnection(m_env, m_conn); m_run_seq.setByID(seq_def_id); result->setDescription( rset->getString(5) ); } catch (SQLException &e) { throw(std::runtime_error("ODRunConfigSeqInfo::fetchData(): "+e.getMessage())); } }
int ODRunConfigSeqInfo::fetchID | ( | ) | throw (std::runtime_error) [private] |
Definition at line 43 of file ODRunConfigSeqInfo.cc.
References alignCSCRings::e.
{ // Return from memory if available if (m_ID>0) { return m_ID; } this->checkConnection(); DateHandler dh(m_env, m_conn); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT sequence_id from ECAL_sequence_DAT " "WHERE ecal_config_id = :id1 " " and sequence_num = :id2 " ); stmt->setInt(1, m_ecal_config_id); stmt->setInt(2, m_seq_num); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_ID = rset->getInt(1); } else { m_ID = 0; } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("ODRunConfigSeqInfo::fetchID: "+e.getMessage())); } setByID(m_ID); return m_ID; }
int ODRunConfigSeqInfo::fetchIDLast | ( | ) | throw (std::runtime_error) [private] |
Definition at line 81 of file ODRunConfigSeqInfo.cc.
References alignCSCRings::e.
{ this->checkConnection(); DateHandler dh(m_env, m_conn); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT max(sequence_id) FROM ecal_sequence_dat " ); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_ID = rset->getInt(1); } else { m_ID = 0; } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("ODRunConfigSeqInfo::fetchIDLast: "+e.getMessage())); } setByID(m_ID); return m_ID; }
std::string ODRunConfigSeqInfo::getDescription | ( | ) | const [inline] |
Definition at line 31 of file ODRunConfigSeqInfo.h.
References m_description.
{ return m_description;}
int ODRunConfigSeqInfo::getEcalConfigId | ( | ) | const [inline] |
Definition at line 33 of file ODRunConfigSeqInfo.h.
References m_ecal_config_id.
{ return m_ecal_config_id;}
int ODRunConfigSeqInfo::getId | ( | ) | const [inline] |
int ODRunConfigSeqInfo::getNumberOfCycles | ( | ) | const [inline] |
RunSeqDef ODRunConfigSeqInfo::getRunSeqDef | ( | ) | const |
Definition at line 31 of file ODRunConfigSeqInfo.cc.
{ return m_run_seq;}
int ODRunConfigSeqInfo::getSequenceId | ( | ) | const [inline] |
Definition at line 36 of file ODRunConfigSeqInfo.h.
References m_ID.
Referenced by popcon::EcalSRPHandler::getNewObjects().
{ return m_ID;}
int ODRunConfigSeqInfo::getSequenceNumber | ( | ) | const [inline] |
std::string ODRunConfigSeqInfo::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 22 of file ODRunConfigSeqInfo.h.
{ return "ECAL_SEQUENCE_DAT"; }
bool ODRunConfigSeqInfo::operator!= | ( | const ODRunConfigSeqInfo & | r | ) | const [inline] |
Definition at line 46 of file ODRunConfigSeqInfo.h.
References alignCSCRings::r.
{ return !(*this == r); }
bool ODRunConfigSeqInfo::operator== | ( | const ODRunConfigSeqInfo & | r | ) | const [inline] |
void ODRunConfigSeqInfo::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 143 of file ODRunConfigSeqInfo.cc.
References alignCSCRings::e.
{ this->checkConnection(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO ECAL_SEQUENCE_DAT ( ecal_config_id, " "sequence_num, num_of_cycles, sequence_type_def_id, description ) " "VALUES (:1, :2, :3 , :4, :5 )"); } catch (SQLException &e) { throw(std::runtime_error("ODRunConfigSeqInfo::prepareWrite(): "+e.getMessage())); } }
void ODRunConfigSeqInfo::setByID | ( | int | id | ) | throw (std::runtime_error) [private] |
Definition at line 109 of file ODRunConfigSeqInfo.cc.
References gather_cfg::cout, alignCSCRings::e, and errorMatrix2Lands_multiChannel::id.
{ this->checkConnection(); DateHandler dh(m_env, m_conn); cout<< "ODRunConfigSeqInfo::setByID called for id "<<id<<endl; try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT ecal_config_id, sequence_num, num_of_cycles, sequence_type_def_id, description FROM ECAL_sequence_DAT WHERE sequence_id = :1 "); stmt->setInt(1, id); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_ecal_config_id= rset->getInt(1); m_seq_num=rset->getInt(2); m_cycles=rset->getInt(3); int seq_def_id=rset->getInt(4); m_description= rset->getString(5); m_ID = id; m_run_seq.setConnection(m_env, m_conn); m_run_seq.setByID(seq_def_id); } else { throw(std::runtime_error("ODRunConfigSeqInfo::setByID: Given config_id is not in the database")); } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("ODRunConfigSeqInfo::setByID: "+e.getMessage())); } }
void ODRunConfigSeqInfo::setDescription | ( | std::string | x | ) | [inline] |
Definition at line 30 of file ODRunConfigSeqInfo.h.
References m_description, and x.
{ m_description = x; }
void ODRunConfigSeqInfo::setEcalConfigId | ( | int | x | ) | [inline] |
Definition at line 32 of file ODRunConfigSeqInfo.h.
References m_ecal_config_id, and x.
Referenced by popcon::EcalSRPHandler::getNewObjects().
{ m_ecal_config_id = x; }
void ODRunConfigSeqInfo::setId | ( | int | id | ) | [inline] |
Definition at line 27 of file ODRunConfigSeqInfo.h.
References errorMatrix2Lands_multiChannel::id, and m_ID.
void ODRunConfigSeqInfo::setNumberOfCycles | ( | int | x | ) | [inline] |
void ODRunConfigSeqInfo::setRunSeqDef | ( | const RunSeqDef | runSeqDef | ) |
Definition at line 32 of file ODRunConfigSeqInfo.cc.
void ODRunConfigSeqInfo::setSequenceId | ( | int | x | ) | [inline] |
void ODRunConfigSeqInfo::setSequenceNumber | ( | int | x | ) | [inline] |
Definition at line 38 of file ODRunConfigSeqInfo.h.
Referenced by popcon::EcalSRPHandler::getNewObjects().
void ODRunConfigSeqInfo::writeDB | ( | ) | throw (std::runtime_error) [private] |
Definition at line 157 of file ODRunConfigSeqInfo.cc.
References gather_cfg::cout, and alignCSCRings::e.
{ this->checkConnection(); this->checkPrepare(); // Validate the data, use infinity-till convention DateHandler dh(m_env, m_conn); try { // get the run mode m_run_seq.setConnection(m_env, m_conn); int seq_def_id = m_run_seq.writeDB(); m_writeStmt->setInt(1, this->getEcalConfigId()); m_writeStmt->setInt(2, this->getSequenceNumber()); m_writeStmt->setInt(3, this->getNumberOfCycles()); m_writeStmt->setInt(4,seq_def_id ); m_writeStmt->setString(5,this->getDescription() ); m_writeStmt->executeUpdate(); } catch (SQLException &e) { throw(std::runtime_error("ODRunConfigSeqInfo::writeDB(): "+e.getMessage())); } if (!this->fetchID()) { throw(std::runtime_error("ODRunConfigSeqInfo::writeDB: Failed to write")); } cout<< "ODRunConfigSeqInfo::writeDB>> done inserting ODRunConfigSeqInfo with id="<<m_ID<<endl; }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 17 of file ODRunConfigSeqInfo.h.
int ODRunConfigSeqInfo::m_cycles [private] |
Definition at line 53 of file ODRunConfigSeqInfo.h.
Referenced by getNumberOfCycles(), and setNumberOfCycles().
std::string ODRunConfigSeqInfo::m_description [private] |
Definition at line 55 of file ODRunConfigSeqInfo.h.
Referenced by getDescription(), and setDescription().
int ODRunConfigSeqInfo::m_ecal_config_id [private] |
Definition at line 50 of file ODRunConfigSeqInfo.h.
Referenced by getEcalConfigId(), and setEcalConfigId().
int ODRunConfigSeqInfo::m_ID [private] |
Definition at line 49 of file ODRunConfigSeqInfo.h.
Referenced by getId(), getSequenceId(), operator==(), setId(), and setSequenceId().
RunSeqDef ODRunConfigSeqInfo::m_run_seq [private] |
Definition at line 54 of file ODRunConfigSeqInfo.h.
int ODRunConfigSeqInfo::m_seq_num [private] |
Definition at line 51 of file ODRunConfigSeqInfo.h.
Referenced by getSequenceNumber(), and setSequenceNumber().
int ODRunConfigSeqInfo::m_sequence_id [private] |
Definition at line 52 of file ODRunConfigSeqInfo.h.