CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
RunConfigDat Class Reference

#include <RunConfigDat.h>

Inheritance diagram for RunConfigDat:
IDataItem IDBObject

Public Member Functions

std::string getConfigTag () const
 
int getConfigVersion () const
 
std::string getTable () override
 
 RunConfigDat ()
 
void setConfigTag (std::string tag)
 
void setConfigVersion (int ver)
 
 ~RunConfigDat () override
 
- 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, RunConfigDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunConfigDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

std::string m_configTag
 
int m_configVer
 

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 () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- 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 RunConfigDat.h.

Constructor & Destructor Documentation

RunConfigDat::RunConfigDat ( )

Definition at line 11 of file RunConfigDat.cc.

12 {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_configTag = "none";
19  m_configVer = 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_configTag
Definition: RunConfigDat.h:34
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
RunConfigDat::~RunConfigDat ( )
override

Definition at line 24 of file RunConfigDat.cc.

25 {
26 }

Member Function Documentation

void RunConfigDat::fetchData ( std::map< EcalLogicID, RunConfigDat > *  fillMap,
RunIOV iov 
)
privatenoexcept

Definition at line 74 of file RunConfigDat.cc.

References MillePedeFileConverter_cfg::e, AlCaHLTBitMon_ParallelJobs::p, setConfigTag(), setConfigVersion(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setConfigVersion().

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

Definition at line 20 of file RunConfigDat.h.

References m_configTag.

Referenced by popcon::EcalSRPHandler::getNewObjects().

20 { return m_configTag; }
std::string m_configTag
Definition: RunConfigDat.h:34
int RunConfigDat::getConfigVersion ( ) const
inline

Definition at line 23 of file RunConfigDat.h.

References m_configVer.

Referenced by popcon::EcalSRPHandler::getNewObjects().

23 { return m_configVer; }
std::string RunConfigDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 18 of file RunConfigDat.h.

18 { return "RUN_CONFIG_DAT"; }
void RunConfigDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 30 of file RunConfigDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setConfigVersion().

32 {
33  this->checkConnection();
34 
35  try {
36  m_writeStmt = m_conn->createStatement();
37  m_writeStmt->setSQL("INSERT INTO run_config_dat (iov_id, logic_id, "
38  "config_tag, config_ver) "
39  "VALUES (:iov_id, :logic_id, "
40  ":config_tag, :config_ver)");
41  } catch (SQLException &e) {
42  throw(std::runtime_error(std::string("RunConfigDat::prepareWrite(): ")+getOraMessage(&e)));
43  }
44 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void RunConfigDat::setConfigTag ( std::string  tag)
inline
void RunConfigDat::setConfigVersion ( int  ver)
inline

Definition at line 24 of file RunConfigDat.h.

References fetchData(), m_configVer, noexcept, prepareWrite(), and writeDB().

Referenced by fetchData().

24 { m_configVer = ver; }
void RunConfigDat::writeDB ( const EcalLogicID ecid,
const RunConfigDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 48 of file RunConfigDat.cc.

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setConfigVersion().

50 {
51  this->checkConnection();
52  this->checkPrepare();
53 
54  int iovID = iov->fetchID();
55  if (!iovID) { throw(std::runtime_error("RunConfigDat::writeDB: IOV not in DB")); }
56 
57  int logicID = ecid->getLogicID();
58  if (!logicID) { throw(std::runtime_error("RunConfigDat::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->getConfigVersion());
65 
66  m_writeStmt->executeUpdate();
67  } catch (SQLException &e) {
68  throw(std::runtime_error(std::string("RunConfigDat::writeDB(): ")+getOraMessage(&e)));
69  }
70 }
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
void checkPrepare() noexcept(false)
Definition: IDataItem.h:31
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
int getConfigVersion() const
Definition: RunConfigDat.h:23
int getLogicID() const
Definition: EcalLogicID.cc:41
std::string getConfigTag() const
Definition: RunConfigDat.h:20
int fetchID() noexcept(false) override
Definition: RunIOV.cc:103

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 13 of file RunConfigDat.h.

Member Data Documentation

std::string RunConfigDat::m_configTag
private

Definition at line 34 of file RunConfigDat.h.

Referenced by getConfigTag(), and setConfigTag().

int RunConfigDat::m_configVer
private

Definition at line 35 of file RunConfigDat.h.

Referenced by getConfigVersion(), and setConfigVersion().