CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Friends
RunTypeDef Class Reference

#include <RunTypeDef.h>

Inheritance diagram for RunTypeDef:
IDef IUniqueDBObject IDBObject

Public Member Functions

int fetchID () throw (std::runtime_error)
 
std::string getDescription () const
 
std::string getRunType () const
 
bool operator!= (const RunTypeDef &t) const
 
bool operator== (const RunTypeDef &t) const
 
 RunTypeDef ()
 
void setByID (int id) throw (std::runtime_error)
 
void setRunType (std::string runtype)
 
virtual ~RunTypeDef ()
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Protected Member Functions

void fetchAllDefs (std::vector< RunTypeDef > *fillVec) throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 

Protected Attributes

std::string m_desc
 
std::string m_runType
 
- Protected Attributes inherited from IUniqueDBObject
int m_ID
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 

Detailed Description

Def for Location information

Definition at line 12 of file RunTypeDef.h.

Constructor & Destructor Documentation

RunTypeDef::RunTypeDef ( )

Definition at line 9 of file RunTypeDef.cc.

References NULL.

10 {
11  m_env = NULL;
12  m_conn = NULL;
13  m_ID = 0;
14  m_runType = "";
15  m_desc = "";
16 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_runType
Definition: RunTypeDef.h:35
#define NULL
Definition: scimark2.h:8
std::string m_desc
Definition: RunTypeDef.h:36
RunTypeDef::~RunTypeDef ( )
virtual

Definition at line 20 of file RunTypeDef.cc.

21 {
22 }

Member Function Documentation

void RunTypeDef::fetchAllDefs ( std::vector< RunTypeDef > *  fillVec)
throw (std::runtime_error
)
protected

Definition at line 111 of file RunTypeDef.cc.

References alignCSCRings::e, setByID(), and IDBObject::setConnection().

113 {
114  this->checkConnection();
115  try {
116  Statement* stmt = m_conn->createStatement();
117  stmt->setSQL("SELECT def_id FROM run_type_def ORDER BY def_id");
118  ResultSet* rset = stmt->executeQuery();
119 
120  RunTypeDef runTypeDef;
121  runTypeDef.setConnection(m_env, m_conn);
122 
123  while(rset->next()) {
124  runTypeDef.setByID( rset->getInt(1) );
125  fillVec->push_back( runTypeDef );
126  }
127  } catch (SQLException &e) {
128  throw(std::runtime_error("RunTypeDef::fetchAllDefs: "+e.getMessage()));
129  }
130 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setByID(int id)
Definition: RunTypeDef.cc:84
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
int RunTypeDef::fetchID ( )
throw (std::runtime_error
)
virtual

Implements IUniqueDBObject.

Definition at line 50 of file RunTypeDef.cc.

References alignCSCRings::e.

52 {
53  // Return def from memory if available
54  if (m_ID) {
55  return m_ID;
56  }
57 
58  this->checkConnection();
59 
60  try {
61  Statement* stmt = m_conn->createStatement();
62  stmt->setSQL("SELECT def_id FROM run_type_def WHERE "
63  "run_type = :1"
64  );
65  stmt->setString(1, m_runType);
66 
67  ResultSet* rset = stmt->executeQuery();
68 
69  if (rset->next()) {
70  m_ID = rset->getInt(1);
71  } else {
72  m_ID = 0;
73  }
74  m_conn->terminateStatement(stmt);
75  } catch (SQLException &e) {
76  throw(std::runtime_error("RunTypeDef::fetchID: "+e.getMessage()));
77  }
78 
79  return m_ID;
80 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_runType
Definition: RunTypeDef.h:35
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void checkConnection() const
Definition: IDBObject.h:41
string RunTypeDef::getDescription ( ) const

Definition at line 43 of file RunTypeDef.cc.

44 {
45  return m_desc;
46 }
std::string m_desc
Definition: RunTypeDef.h:36
string RunTypeDef::getRunType ( ) const

Definition at line 26 of file RunTypeDef.cc.

Referenced by EcalTPGDBApp::printTag().

27 {
28  return m_runType;
29 }
std::string m_runType
Definition: RunTypeDef.h:35
bool RunTypeDef::operator!= ( const RunTypeDef t) const
inline

Definition at line 31 of file RunTypeDef.h.

References m_runType.

31 { return m_runType != t.m_runType; }
std::string m_runType
Definition: RunTypeDef.h:35
bool RunTypeDef::operator== ( const RunTypeDef t) const
inline

Definition at line 30 of file RunTypeDef.h.

References m_runType.

30 { return m_runType == t.m_runType; }
std::string m_runType
Definition: RunTypeDef.h:35
void RunTypeDef::setByID ( int  id)
throw (std::runtime_error
)
virtual

Implements IUniqueDBObject.

Definition at line 84 of file RunTypeDef.cc.

References alignCSCRings::e.

Referenced by fetchAllDefs().

86 {
87  this->checkConnection();
88 
89  try {
90  Statement* stmt = m_conn->createStatement();
91 
92  stmt->setSQL("SELECT run_type, description FROM run_type_def WHERE def_id = :1");
93  stmt->setInt(1, id);
94 
95  ResultSet* rset = stmt->executeQuery();
96  if (rset->next()) {
97  m_runType = rset->getString(1);
98  m_desc = rset->getString(2);
99  } else {
100  throw(std::runtime_error("RunTypeDef::setByID: Given def_id is not in the database"));
101  }
102 
103  m_conn->terminateStatement(stmt);
104  } catch (SQLException &e) {
105  throw(std::runtime_error("RunTypeDef::setByID: "+e.getMessage()));
106  }
107 }
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_runType
Definition: RunTypeDef.h:35
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
std::string m_desc
Definition: RunTypeDef.h:36
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void checkConnection() const
Definition: IDBObject.h:41
void RunTypeDef::setRunType ( std::string  runtype)

Definition at line 33 of file RunTypeDef.cc.

Referenced by EcalCondDBWriter::dqmEndJob(), RunList::fetchGlobalRunsByLocation(), RunList::fetchRunsByLocation(), popcon::EcalSRPHandler::getNewObjects(), popcon::EcalDAQHandler::getNewObjects(), popcon::EcalTPGBadStripHandler::getNewObjects(), popcon::EcalTPGBadTTHandler::getNewObjects(), popcon::EcalTPGLutIdMapHandler::getNewObjects(), popcon::EcalTPGPhysicsConstHandler::getNewObjects(), popcon::EcalTPGWeightIdMapHandler::getNewObjects(), popcon::EcalTPGFineGrainEBIdMapHandler::getNewObjects(), popcon::EcalTPGLinConstHandler::getNewObjects(), popcon::EcalTPGBadXTHandler::getNewObjects(), popcon::EcalTPGFineGrainEBGroupHandler::getNewObjects(), popcon::EcalTPGFineGrainTowerEEHandler::getNewObjects(), popcon::EcalTPGWeightGroupHandler::getNewObjects(), popcon::EcalTPGPedestalsHandler::getNewObjects(), popcon::EcalTPGSlidingWindowHandler::getNewObjects(), popcon::EcalTPGFineGrainStripEEHandler::getNewObjects(), popcon::EcalTPGLutGroupHandler::getNewObjects(), popcon::EcalTPGSpikeThresholdHandler::getNewObjects(), popcon::EcalChannelStatusHandler::getNewObjects(), popcon::EcalPedestalsHandler::getNewObjectsH2(), popcon::EcalPedestalsHandler::getNewObjectsP5(), EcalTPGDBApp::readFromCondDB_Pedestals(), and EcalPedOffset::writeDb().

34 {
35  if (runtype != m_runType) {
36  m_ID = 0;
37  m_runType = runtype;
38  }
39 }
std::string m_runType
Definition: RunTypeDef.h:35

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file RunTypeDef.h.

Member Data Documentation

std::string RunTypeDef::m_desc
protected

Definition at line 36 of file RunTypeDef.h.

std::string RunTypeDef::m_runType
protected

Definition at line 35 of file RunTypeDef.h.

Referenced by operator!=(), and operator==().