CMS 3D CMS Logo

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

#include <RunTPGConfigDat.h>

Inheritance diagram for RunTPGConfigDat:
IDataItem IDBObject

Public Member Functions

std::string getConfigTag () const
 
std::string getTable ()
 
int getVersion () const
 
 RunTPGConfigDat ()
 
void setConfigTag (std::string x)
 
void setVersion (int x)
 
 ~RunTPGConfigDat ()
 
- Public Member Functions inherited from IDataItem
 IDataItem ()
 
- 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 ()
 

Private Member Functions

void fetchData (std::map< EcalLogicID, RunTPGConfigDat > *fillMap, RunIOV *iov) throw (std::runtime_error)
 
void prepareWrite () throw (std::runtime_error)
 
void writeDB (const EcalLogicID *ecid, const RunTPGConfigDat *item, RunIOV *iov) throw (std::runtime_error)
 

Private Attributes

std::string m_config
 
int m_version
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Static Public Attributes inherited from IDBObject
static int const ECALDB_NROWS =1024
 
- Protected Member Functions inherited from IDataItem
void checkPrepare () throw (std::runtime_error)
 
void createReadStatement () throw (std::runtime_error)
 
void setPrefetchRowCount (int ncount) throw (std::runtime_error)
 
void terminateReadStatement () throw (std::runtime_error)
 
void terminateWriteStatement () throw (std::runtime_error)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const throw (std::runtime_error)
 
- Protected Attributes inherited from IDataItem
oracle::occi::Statement * m_readStmt
 
oracle::occi::Statement * m_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 11 of file RunTPGConfigDat.h.

Constructor & Destructor Documentation

RunTPGConfigDat::RunTPGConfigDat ( )

Definition at line 11 of file RunTPGConfigDat.cc.

References NULL.

12 {
13  m_env = NULL;
14  m_conn = NULL;
15  m_writeStmt = NULL;
16  m_readStmt = NULL;
17 
18  m_config = "";
19  m_version=0;
20 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
std::string m_config
#define NULL
Definition: scimark2.h:8
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
RunTPGConfigDat::~RunTPGConfigDat ( )

Definition at line 24 of file RunTPGConfigDat.cc.

25 {
26 }

Member Function Documentation

void RunTPGConfigDat::fetchData ( std::map< EcalLogicID, RunTPGConfigDat > *  fillMap,
RunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 75 of file RunTPGConfigDat.cc.

References alignCSCRings::e, o2o::iov, AlCaHLTBitMon_ParallelJobs::p, setConfigTag(), and setVersion().

77 {
78  this->checkConnection();
79  fillMap->clear();
80 
81  iov->setConnection(m_env, m_conn);
82  int iovID = iov->fetchID();
83  if (!iovID) {
84  // throw(std::runtime_error("RunTPGConfigDat::writeDB: IOV not in DB"));
85  return;
86  }
87 
88  try {
89 
90  m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
91  "d.Config_tag, d.version "
92  "FROM channelview cv JOIN run_TPGConfig_dat d "
93  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
94  "WHERE d.iov_id = :iov_id");
95  m_readStmt->setInt(1, iovID);
96  ResultSet* rset = m_readStmt->executeQuery();
97 
98  std::pair< EcalLogicID, RunTPGConfigDat > p;
99  RunTPGConfigDat dat;
100  while(rset->next()) {
101  p.first = EcalLogicID( rset->getString(1), // name
102  rset->getInt(2), // logic_id
103  rset->getInt(3), // id1
104  rset->getInt(4), // id2
105  rset->getInt(5), // id3
106  rset->getString(6)); // maps_to
107 
108  dat.setConfigTag( rset->getString(7) );
109  dat.setVersion( rset->getInt(8) );
110 
111 
112  p.second = dat;
113  fillMap->insert(p);
114  }
115  } catch (SQLException &e) {
116  throw(std::runtime_error("RunTPGConfigDat::fetchData(): "+e.getMessage()));
117  }
118 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setConfigTag(std::string x)
int fetchID()
Definition: RunIOV.cc:103
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void setVersion(int x)
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
oracle::occi::ResultSet ResultSet
Definition: HcalDbOmds.cc:26
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
void checkConnection() const
Definition: IDBObject.h:41
std::string RunTPGConfigDat::getConfigTag ( ) const
inline
std::string RunTPGConfigDat::getTable ( )
inlinevirtual

Implements IDataItem.

Definition at line 18 of file RunTPGConfigDat.h.

18 { return "RUN_TPGCONFIG_DAT"; }
int RunTPGConfigDat::getVersion ( ) const
inline
void RunTPGConfigDat::prepareWrite ( )
throw (std::runtime_error
)
privatevirtual

Implements IDataItem.

Definition at line 30 of file RunTPGConfigDat.cc.

References alignCSCRings::e.

32 {
33  this->checkConnection();
34 
35  try {
36  m_writeStmt = m_conn->createStatement();
37  m_writeStmt->setSQL("INSERT INTO run_TPGConfig_dat (iov_id, logic_id, "
38  "Config_tag , version ) "
39  "VALUES (:iov_id, :logic_id, "
40  ":Config_tag , :version ) ");
41  } catch (SQLException &e) {
42  throw(std::runtime_error("RunTPGConfigDat::prepareWrite(): "+e.getMessage()));
43  }
44 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
void checkConnection() const
Definition: IDBObject.h:41
void RunTPGConfigDat::setConfigTag ( std::string  x)
inline

Definition at line 21 of file RunTPGConfigDat.h.

References m_config, and x.

Referenced by fetchData().

21 { m_config = x; }
std::string m_config
void RunTPGConfigDat::setVersion ( int  x)
inline

Definition at line 23 of file RunTPGConfigDat.h.

References m_version, and x.

Referenced by fetchData().

void RunTPGConfigDat::writeDB ( const EcalLogicID ecid,
const RunTPGConfigDat item,
RunIOV iov 
)
throw (std::runtime_error
)
private

Definition at line 48 of file RunTPGConfigDat.cc.

References alignCSCRings::e, and o2o::iov.

50 {
51  this->checkConnection();
52  this->checkPrepare();
53 
54  int iovID = iov->fetchID();
55  if (!iovID) { throw(std::runtime_error("RunTPGConfigDat::writeDB: IOV not in DB")); }
56 
57  int logicID = ecid->getLogicID();
58  if (!logicID) { throw(std::runtime_error("RunTPGConfigDat::writeDB: Bad EcalLogicID")); }
59 
60  try {
61  m_writeStmt->setInt(1, iovID);
62  m_writeStmt->setInt(2, logicID);
63  m_writeStmt->setString(3, item->getConfigTag());
64  m_writeStmt->setInt(4, item->getVersion());
65 
66 
67  m_writeStmt->executeUpdate();
68  } catch (SQLException &e) {
69  throw(std::runtime_error("RunTPGConfigDat::writeDB(): "+e.getMessage()));
70  }
71 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
std::string getConfigTag() const
int getVersion() const
int fetchID()
Definition: RunIOV.cc:103
oracle::occi::SQLException SQLException
Definition: HcalDbOmds.cc:27
int getLogicID() const
Definition: EcalLogicID.cc:41
void checkPrepare()
Definition: IDataItem.h:31
void checkConnection() const
Definition: IDBObject.h:41

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunTPGConfigDat.h.

Member Data Documentation

std::string RunTPGConfigDat::m_config
private

Definition at line 38 of file RunTPGConfigDat.h.

Referenced by getConfigTag(), and setConfigTag().

int RunTPGConfigDat::m_version
private

Definition at line 37 of file RunTPGConfigDat.h.

Referenced by getVersion(), and setVersion().