#include <MonVersionDef.h>
Public Member Functions | |
int | fetchID () throw (std::runtime_error) |
std::string | getDescription () const |
std::string | getMonitoringVersion () const |
MonVersionDef () | |
bool | operator!= (const MonVersionDef &d) const |
bool | operator== (const MonVersionDef &d) const |
void | setByID (int id) throw (std::runtime_error) |
void | setMonitoringVersion (std::string ver) |
virtual | ~MonVersionDef () |
Protected Member Functions | |
void | fetchAllDefs (std::vector< MonVersionDef > *fillVec) throw (std::runtime_error) |
Protected Attributes | |
std::string | m_desc |
std::string | m_monVer |
Friends | |
class | EcalCondDBInterface |
Def for Location information
Definition at line 12 of file MonVersionDef.h.
MonVersionDef::MonVersionDef | ( | ) |
MonVersionDef::~MonVersionDef | ( | ) | [virtual] |
Definition at line 20 of file MonVersionDef.cc.
{ }
void MonVersionDef::fetchAllDefs | ( | std::vector< MonVersionDef > * | fillVec | ) | throw (std::runtime_error) [protected] |
Definition at line 110 of file MonVersionDef.cc.
References alignCSCRings::e, setByID(), and IDBObject::setConnection().
{ this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT def_id FROM mon_version_def ORDER BY def_id"); ResultSet* rset = stmt->executeQuery(); MonVersionDef monVersionDef; monVersionDef.setConnection(m_env, m_conn); while(rset->next()) { monVersionDef.setByID( rset->getInt(1) ); fillVec->push_back( monVersionDef ); } } catch (SQLException &e) { throw(std::runtime_error("MonVersionDef::fetchAllDefs: "+e.getMessage())); } }
int MonVersionDef::fetchID | ( | ) | throw (std::runtime_error) [virtual] |
Implements IUniqueDBObject.
Definition at line 49 of file MonVersionDef.cc.
References alignCSCRings::e.
{ // Return def from memory if available if (m_ID) { return m_ID; } this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT def_id FROM mon_version_def WHERE " "mon_ver = :1" ); stmt->setString(1, m_monVer); 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("MonVersionDef::fetchID: "+e.getMessage())); } return m_ID; }
string MonVersionDef::getDescription | ( | ) | const |
Definition at line 42 of file MonVersionDef.cc.
{ return m_desc; }
string MonVersionDef::getMonitoringVersion | ( | ) | const |
Definition at line 26 of file MonVersionDef.cc.
{ return m_monVer; }
bool MonVersionDef::operator!= | ( | const MonVersionDef & | d | ) | const [inline] |
Definition at line 31 of file MonVersionDef.h.
References m_monVer.
bool MonVersionDef::operator== | ( | const MonVersionDef & | d | ) | const [inline] |
Definition at line 30 of file MonVersionDef.h.
References m_monVer.
void MonVersionDef::setByID | ( | int | id | ) | throw (std::runtime_error) [virtual] |
Implements IUniqueDBObject.
Definition at line 83 of file MonVersionDef.cc.
References alignCSCRings::e.
Referenced by fetchAllDefs().
{ this->checkConnection(); try { Statement* stmt = m_conn->createStatement(); stmt->setSQL("SELECT mon_ver, description FROM mon_version_def WHERE def_id = :1"); stmt->setInt(1, id); ResultSet* rset = stmt->executeQuery(); if (rset->next()) { m_monVer = rset->getString(1); m_desc = rset->getString(2); } else { throw(std::runtime_error("MonVersionDef::setByID: Given def_id is not in the database")); } m_conn->terminateStatement(stmt); } catch (SQLException &e) { throw(std::runtime_error("MonVersionDef::setByID: "+e.getMessage())); } }
void MonVersionDef::setMonitoringVersion | ( | std::string | ver | ) |
Definition at line 33 of file MonVersionDef.cc.
References cmsDownloadME::ver.
Referenced by popcon::EcalChannelStatusHandler::getNewObjects(), popcon::EcalPedestalsHandler::getNewObjectsH2(), popcon::EcalPedestalsHandler::getNewObjectsP5(), EcalTPGDBApp::readFromCondDB_Pedestals(), EcalEndcapMonitorClient::writeDb(), EcalBarrelMonitorClient::writeDb(), and EcalPedOffset::writeDb().
friend class EcalCondDBInterface [friend] |
Reimplemented from IDBObject.
Definition at line 14 of file MonVersionDef.h.
std::string MonVersionDef::m_desc [protected] |
Definition at line 36 of file MonVersionDef.h.
std::string MonVersionDef::m_monVer [protected] |
Definition at line 35 of file MonVersionDef.h.
Referenced by operator!=(), and operator==().