#include <ODTCCEEConfig.h>
Public Member Functions | |
int | getId () const |
unsigned char * | getLUTClob () const |
std::string | getLUTConfigurationFile () const |
int | getNTestPatternsToLoad () const |
unsigned char * | getSLBClob () const |
std::string | getSLBConfigurationFile () const |
int | getSLBLatency () const |
std::string | getTable () |
unsigned char * | getTCCClob () const |
std::string | getTCCConfigurationFile () const |
std::string | getTestPatternFileUrl () const |
int | getTrigPos () const |
ODTCCEEConfig () | |
void | setId (int id) |
void | setLUTClob (unsigned char *x) |
void | setLUTConfigurationFile (std::string x) |
void | setNTestPatternsToLoad (int id) |
void | setParameters (std::map< std::string, std::string > my_keys_map) |
void | setSLBClob (unsigned char *x) |
void | setSLBConfigurationFile (std::string x) |
void | setSLBLatency (int id) |
void | setTCCClob (unsigned char *x) |
void | setTCCConfigurationFile (std::string x) |
void | setTestPatternFileUrl (std::string x) |
void | setTriggerPos (int id) |
~ODTCCEEConfig () | |
Private Member Functions | |
void | clear () |
void | fetchData (ODTCCEEConfig *result) throw (std::runtime_error) |
int | fetchID () throw (std::runtime_error) |
int | fetchNextId () throw (std::runtime_error) |
void | prepareWrite () throw (std::runtime_error) |
void | writeDB () throw (std::runtime_error) |
Private Attributes | |
int | m_ID |
unsigned char * | m_lut_clob |
std::string | m_lut_file |
int | m_ntest |
unsigned int | m_size |
int | m_slb |
unsigned char * | m_slb_clob |
std::string | m_slb_file |
unsigned char * | m_tcc_ee_clob |
std::string | m_tcc_ee_file |
std::string | m_test_url |
int | m_trigpos |
Friends | |
class | EcalCondDBInterface |
Definition at line 15 of file ODTCCEEConfig.h.
ODTCCEEConfig::ODTCCEEConfig | ( | ) |
Definition at line 12 of file ODTCCEEConfig.cc.
References hitfit::clear(), and NULL.
{ m_env = NULL; m_conn = NULL; m_writeStmt = NULL; m_readStmt = NULL; m_config_tag=""; m_ID=0; clear(); m_size=0; }
ODTCCEEConfig::~ODTCCEEConfig | ( | ) |
Definition at line 35 of file ODTCCEEConfig.cc.
{ }
void ODTCCEEConfig::clear | ( | void | ) | [private] |
Definition at line 25 of file ODTCCEEConfig.cc.
{ m_tcc_ee_file=""; m_lut_file=""; m_slb_file=""; m_test_url=""; m_ntest=0; }
void ODTCCEEConfig::fetchData | ( | ODTCCEEConfig * | result | ) | throw (std::runtime_error) [private] |
Definition at line 188 of file ODTCCEEConfig.cc.
References gather_cfg::cout, alignCSCRings::e, i, and query::result.
{ this->checkConnection(); result->clear(); if(result->getId()==0 && (result->getConfigTag()=="") ){ throw(std::runtime_error("ODTCCEEConfig::fetchData(): no Id defined for this ODTCCEEConfig ")); } try { m_readStmt->setSQL("SELECT * " "FROM ECAL_TCC_EE_CONFIGURATION d " " where (tcc_ee_configuration_id = :1 or tcc_ee_tag=:2 )" ); m_readStmt->setInt(1, result->getId()); m_readStmt->setString(2, result->getConfigTag()); ResultSet* rset = m_readStmt->executeQuery(); rset->next(); // the first is the id result->setId(rset->getInt(1)); result->setConfigTag(rset->getString(2)); result->setTCCConfigurationFile(rset->getString(3)); result->setLUTConfigurationFile(rset->getString(4)); result->setSLBConfigurationFile(rset->getString(5)); result->setTestPatternFileUrl(rset->getString(6)); result->setNTestPatternsToLoad(rset->getInt(7)); result->setSLBLatency(rset->getInt(12)); // Clob clob1 = rset->getClob (8); cout << "Opening the clob in Read only mode" << endl; clob1.open (OCCI_LOB_READONLY); int clobLength=clob1.length (); cout << "Length of the clob1 is: " << clobLength << endl; unsigned char* buffer = readClob (clob1, clobLength); clob1.close (); cout<< "the clob buffer is:"<<endl; for (int i = 0; i < clobLength; ++i) cout << (char) buffer[i]; cout << endl; result->setTCCClob(buffer ); Clob clob2 = rset->getClob (9); cout << "Opening the clob in Read only mode" << endl; clob2.open (OCCI_LOB_READONLY); clobLength=clob2.length (); cout << "Length of the clob2 is: " << clobLength << endl; unsigned char* buffer2 = readClob (clob2, clobLength); clob2.close (); cout<< "the clob buffer is:"<<endl; for (int i = 0; i < clobLength; ++i) cout << (char) buffer2[i]; cout << endl; result->setLUTClob(buffer2 ); Clob clob3 = rset->getClob (10); cout << "Opening the clob in Read only mode" << endl; clob3.open (OCCI_LOB_READONLY); clobLength=clob3.length (); cout << "Length of the clob3 is: " << clobLength << endl; unsigned char* buffer3 = readClob (clob3, clobLength); clob3.close (); cout<< "the clob buffer is:"<<endl; for (int i = 0; i < clobLength; ++i) cout << (char) buffer3[i]; cout << endl; result->setSLBClob(buffer3 ); } catch (SQLException &e) { throw(std::runtime_error("ODTCCEEConfig::fetchData(): "+e.getMessage())); } }
int ODTCCEEConfig::fetchID | ( | ) | throw (std::runtime_error) [private] |
Definition at line 265 of file ODTCCEEConfig.cc.
References alignCSCRings::e.
{ if (m_ID!=0) { return m_ID; } this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT tcc_ee_configuration_id FROM ecal_tcc_ee_configuration " "WHERE tcc_ee_tag=:tcc_ee_tag " ); stmt->setString(1, getConfigTag() ); 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("ODTCCEEConfig::fetchID: "+e.getMessage())); } return m_ID; }
int ODTCCEEConfig::fetchNextId | ( | ) | throw (std::runtime_error) [private] |
Definition at line 39 of file ODTCCEEConfig.cc.
References alignCSCRings::e, and query::result.
{ int result=0; try { this->checkConnection(); m_readStmt = m_conn->createStatement(); m_readStmt->setSQL("select ecal_tcc_ee_config_sq.NextVal from dual"); ResultSet* rset = m_readStmt->executeQuery(); while (rset->next ()){ result= rset->getInt(1); } m_conn->terminateStatement(m_readStmt); return result; } catch (SQLException &e) { throw(std::runtime_error("ODTCCEEConfig::fetchNextId(): "+e.getMessage())); } }
int ODTCCEEConfig::getId | ( | ) | const [inline] |
unsigned char* ODTCCEEConfig::getLUTClob | ( | ) | const [inline] |
std::string ODTCCEEConfig::getLUTConfigurationFile | ( | ) | const [inline] |
int ODTCCEEConfig::getNTestPatternsToLoad | ( | ) | const [inline] |
unsigned char* ODTCCEEConfig::getSLBClob | ( | ) | const [inline] |
std::string ODTCCEEConfig::getSLBConfigurationFile | ( | ) | const [inline] |
int ODTCCEEConfig::getSLBLatency | ( | ) | const [inline] |
std::string ODTCCEEConfig::getTable | ( | ) | [inline, virtual] |
Implements IODConfig.
Definition at line 22 of file ODTCCEEConfig.h.
{ return "ECAL_TCC_EE_CONFIGURATION"; }
unsigned char* ODTCCEEConfig::getTCCClob | ( | ) | const [inline] |
std::string ODTCCEEConfig::getTCCConfigurationFile | ( | ) | const [inline] |
std::string ODTCCEEConfig::getTestPatternFileUrl | ( | ) | const [inline] |
int ODTCCEEConfig::getTrigPos | ( | ) | const [inline] |
void ODTCCEEConfig::prepareWrite | ( | ) | throw (std::runtime_error) [private, virtual] |
Implements IODConfig.
Definition at line 87 of file ODTCCEEConfig.cc.
References gather_cfg::cout, and alignCSCRings::e.
{ this->checkConnection(); int next_id=fetchNextId(); try { m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL("INSERT INTO ECAL_TCC_EE_CONFIGURATION (tcc_ee_configuration_id, tcc_ee_tag, " "Configuration_file, LUT_CONFIGURATION_FILE, SLB_CONFIGURATION_FILE, " "TESTPATTERNFILE_URL , N_TESTPATTERNS_TO_LOAD, TRIGGER_POS, " "tcc_configuration, lut_configuration, slb_configuration, slblatency ) " "VALUES (:1, :2, :3, :4, :5, :6, :7, :8 , :9, :10, :11, :12)"); m_writeStmt->setInt(1, next_id); m_writeStmt->setString(2, getConfigTag()); m_writeStmt->setString(3, getTCCConfigurationFile()); m_writeStmt->setString(4, getLUTConfigurationFile()); m_writeStmt->setString(5, getSLBConfigurationFile()); m_writeStmt->setString(6, getTestPatternFileUrl()); m_writeStmt->setInt(7, getNTestPatternsToLoad()); m_writeStmt->setInt(8, getTrigPos()); m_writeStmt->setInt(12, getSLBLatency()); // and now the clobs oracle::occi::Clob clob1(m_conn); clob1.setEmpty(); m_writeStmt->setClob(9,clob1); oracle::occi::Clob clob2(m_conn); clob2.setEmpty(); m_writeStmt->setClob(10,clob2); oracle::occi::Clob clob3(m_conn); clob3.setEmpty(); m_writeStmt->setClob(11,clob3); m_writeStmt->executeUpdate (); m_ID=next_id; m_conn->terminateStatement(m_writeStmt); std::cout<<"TCC 3 empty Clobs inserted into CONFIGURATION with id="<<next_id<<std::endl; // now we read and update it m_writeStmt = m_conn->createStatement(); m_writeStmt->setSQL ("SELECT tcc_configuration, lut_configuration, slb_configuration FROM ECAL_TCC_EE_CONFIGURATION WHERE" " tcc_ee_configuration_id=:1 FOR UPDATE"); std::cout<<"updating the clobs 0"<<std::endl; } catch (SQLException &e) { throw(std::runtime_error("ODTCCEEConfig::prepareWrite(): "+e.getMessage())); } std::cout<<"updating the clob 1 "<<std::endl; }
void ODTCCEEConfig::setId | ( | int | id | ) | [inline] |
Definition at line 24 of file ODTCCEEConfig.h.
References errorMatrix2Lands_multiChannel::id, and m_ID.
void ODTCCEEConfig::setLUTClob | ( | unsigned char * | x | ) | [inline] |
void ODTCCEEConfig::setLUTConfigurationFile | ( | std::string | x | ) | [inline] |
void ODTCCEEConfig::setNTestPatternsToLoad | ( | int | id | ) | [inline] |
Definition at line 35 of file ODTCCEEConfig.h.
References errorMatrix2Lands_multiChannel::id, and m_ntest.
void ODTCCEEConfig::setParameters | ( | std::map< std::string, std::string > | my_keys_map | ) |
void ODTCCEEConfig::setSLBClob | ( | unsigned char * | x | ) | [inline] |
void ODTCCEEConfig::setSLBConfigurationFile | ( | std::string | x | ) | [inline] |
void ODTCCEEConfig::setSLBLatency | ( | int | id | ) | [inline] |
Definition at line 40 of file ODTCCEEConfig.h.
References errorMatrix2Lands_multiChannel::id, and m_slb.
void ODTCCEEConfig::setTCCClob | ( | unsigned char * | x | ) | [inline] |
Definition at line 43 of file ODTCCEEConfig.h.
References m_tcc_ee_clob, and x.
{ m_tcc_ee_clob = x; }
void ODTCCEEConfig::setTCCConfigurationFile | ( | std::string | x | ) | [inline] |
Definition at line 27 of file ODTCCEEConfig.h.
References m_tcc_ee_file, and x.
{ m_tcc_ee_file = x; }
void ODTCCEEConfig::setTestPatternFileUrl | ( | std::string | x | ) | [inline] |
void ODTCCEEConfig::setTriggerPos | ( | int | id | ) | [inline] |
Definition at line 37 of file ODTCCEEConfig.h.
References errorMatrix2Lands_multiChannel::id, and m_trigpos.
void ODTCCEEConfig::writeDB | ( | ) | throw (std::runtime_error) [private] |
Definition at line 145 of file ODTCCEEConfig.cc.
References gather_cfg::cout, and alignCSCRings::e.
{ std::cout<<"updating the clob 2"<<std::endl; try { m_writeStmt->setInt(1, m_ID); ResultSet* rset = m_writeStmt->executeQuery(); while (rset->next ()) { oracle::occi::Clob clob1 = rset->getClob (1); oracle::occi::Clob clob2 = rset->getClob (2); oracle::occi::Clob clob3 = rset->getClob (3); cout << "Opening the clob in read write mode" << endl; cout << "Populating the clobs" << endl; populateClob (clob1, getTCCConfigurationFile(), m_size); populateClob (clob2, getLUTConfigurationFile(), m_size); populateClob (clob3, getSLBConfigurationFile(), m_size); } m_writeStmt->executeUpdate(); m_writeStmt->closeResultSet (rset); } catch (SQLException &e) { throw(std::runtime_error("ODTCCEEConfig::writeDB(): "+e.getMessage())); } // Now get the ID if (!this->fetchID()) { throw(std::runtime_error("ODTCCEEConfig::writeDB: Failed to write")); } }
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 17 of file ODTCCEEConfig.h.
int ODTCCEEConfig::m_ID [private] |
Definition at line 66 of file ODTCCEEConfig.h.
unsigned char* ODTCCEEConfig::m_lut_clob [private] |
Definition at line 68 of file ODTCCEEConfig.h.
Referenced by getLUTClob(), and setLUTClob().
std::string ODTCCEEConfig::m_lut_file [private] |
Definition at line 71 of file ODTCCEEConfig.h.
Referenced by getLUTConfigurationFile(), and setLUTConfigurationFile().
int ODTCCEEConfig::m_ntest [private] |
Definition at line 74 of file ODTCCEEConfig.h.
Referenced by getNTestPatternsToLoad(), and setNTestPatternsToLoad().
unsigned int ODTCCEEConfig::m_size [private] |
Definition at line 77 of file ODTCCEEConfig.h.
int ODTCCEEConfig::m_slb [private] |
Definition at line 76 of file ODTCCEEConfig.h.
Referenced by getSLBLatency(), and setSLBLatency().
unsigned char* ODTCCEEConfig::m_slb_clob [private] |
Definition at line 69 of file ODTCCEEConfig.h.
Referenced by getSLBClob(), and setSLBClob().
std::string ODTCCEEConfig::m_slb_file [private] |
Definition at line 72 of file ODTCCEEConfig.h.
Referenced by getSLBConfigurationFile(), and setSLBConfigurationFile().
unsigned char* ODTCCEEConfig::m_tcc_ee_clob [private] |
Definition at line 67 of file ODTCCEEConfig.h.
Referenced by getTCCClob(), and setTCCClob().
std::string ODTCCEEConfig::m_tcc_ee_file [private] |
Definition at line 70 of file ODTCCEEConfig.h.
Referenced by getTCCConfigurationFile(), and setTCCConfigurationFile().
std::string ODTCCEEConfig::m_test_url [private] |
Definition at line 73 of file ODTCCEEConfig.h.
Referenced by getTestPatternFileUrl(), and setTestPatternFileUrl().
int ODTCCEEConfig::m_trigpos [private] |
Definition at line 75 of file ODTCCEEConfig.h.
Referenced by getTrigPos(), and setTriggerPos().