CMS 3D CMS Logo

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

#include <RunFEConfigDat.h>

Inheritance diagram for RunFEConfigDat:
IDataItem IDBObject

Public Member Functions

int getConfigId () const
 
std::list< ODDelaysDatgetDelays ()
 
std::string getTable () override
 
 RunFEConfigDat ()
 
void setConfigId (int x)
 
 ~RunFEConfigDat () 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, RunFEConfigDat > *fillMap, RunIOV *iov) noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB (const EcalLogicID *ecid, const RunFEConfigDat *item, RunIOV *iov) noexcept(false)
 

Private Attributes

int m_config
 

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 12 of file RunFEConfigDat.h.

Constructor & Destructor Documentation

RunFEConfigDat::RunFEConfigDat ( )

Definition at line 11 of file RunFEConfigDat.cc.

12 {
13  m_env = nullptr;
14  m_conn = nullptr;
15  m_writeStmt = nullptr;
16  m_readStmt = nullptr;
17 
18  m_config = 0;
19 
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
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
RunFEConfigDat::~RunFEConfigDat ( )
override

Definition at line 24 of file RunFEConfigDat.cc.

25 {
26 }

Member Function Documentation

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

Definition at line 74 of file RunFEConfigDat.cc.

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

Referenced by EcalCondDBInterface::fetchFEDelaysForRun(), and setConfigId().

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("RunFEConfigDat::writeDB: IOV not in DB"));
84  return;
85  }
86 
87  try {
88 
89  // createReadStatement();
90  // m_readStmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
91  Statement* stmt = m_conn->createStatement();
92  stmt->setSQL("SELECT cv.name, cv.logic_id, cv.id1, cv.id2, cv.id3, cv.maps_to, "
93  "d.Config_id "
94  "FROM channelview cv JOIN run_FEConfig_dat d "
95  "ON cv.logic_id = d.logic_id AND cv.name = cv.maps_to "
96  "WHERE d.iov_id = :iov_id");
97  stmt->setInt(1, iovID);
98  // m_readStmt->setInt(1, iovID);
99  // ResultSet* rset = m_readStmt->executeQuery();
100  ResultSet* rset = stmt->executeQuery();
101 
102  std::pair< EcalLogicID, RunFEConfigDat > p;
103  RunFEConfigDat dat;
104  while(rset->next()) {
105  p.first = EcalLogicID( getOraString(rset,1), // name
106  rset->getInt(2), // logic_id
107  rset->getInt(3), // id1
108  rset->getInt(4), // id2
109  rset->getInt(5), // id3
110  getOraString(rset,6)); // maps_to
111 
112  dat.setConfigId( rset->getInt(7) );
113 
114  p.second = dat;
115  fillMap->insert(p);
116  }
117  // terminateReadStatement();
118  m_conn->terminateStatement(stmt);
119  } catch (SQLException &e) {
120  throw(std::runtime_error(std::string("RunFEConfigDat::fetchData(): ")+getOraMessage(&e)));
121  }
122 }
oracle::occi::Environment * m_env
Definition: IDBObject.h:38
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setConfigId(int x)
void checkConnection() const noexcept(false)
Definition: IDBObject.h:41
void setConnection(oracle::occi::Environment *env, oracle::occi::Connection *conn)
Definition: IDBObject.h:23
int fetchID() noexcept(false) override
Definition: RunIOV.cc:103
int RunFEConfigDat::getConfigId ( ) const
inline
std::list<ODDelaysDat> RunFEConfigDat::getDelays ( )

Referenced by setConfigId().

std::string RunFEConfigDat::getTable ( )
inlineoverridevirtual

Implements IDataItem.

Definition at line 19 of file RunFEConfigDat.h.

19 { return "RUN_FECONFIG_DAT"; }
void RunFEConfigDat::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IDataItem.

Definition at line 30 of file RunFEConfigDat.cc.

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

Referenced by setConfigId().

32 {
33  this->checkConnection();
34 
35  try {
36  m_writeStmt = m_conn->createStatement();
37  m_writeStmt->setSQL("INSERT INTO run_FEConfig_dat (iov_id, logic_id, "
38  "Config_id ) "
39  "VALUES (:iov_id, :logic_id, "
40  ":Config_id ) ");
41  } catch (SQLException &e) {
42  throw(std::runtime_error(std::string("RunFEConfigDat::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 RunFEConfigDat::setConfigId ( int  x)
inline

Definition at line 22 of file RunFEConfigDat.h.

References fetchData(), getDelays(), m_config, noexcept, prepareWrite(), writeDB(), and x.

Referenced by fetchData().

void RunFEConfigDat::writeDB ( const EcalLogicID ecid,
const RunFEConfigDat item,
RunIOV iov 
)
privatenoexcept

Definition at line 48 of file RunFEConfigDat.cc.

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

Referenced by setConfigId().

50 {
51  this->checkConnection();
52  this->checkPrepare();
53 
54  int iovID = iov->fetchID();
55  if (!iovID) { throw(std::runtime_error("RunFEConfigDat::writeDB: IOV not in DB")); }
56 
57  int logicID = ecid->getLogicID();
58  if (!logicID) { throw(std::runtime_error("RunFEConfigDat::writeDB: Bad EcalLogicID")); }
59 
60  try {
61  m_writeStmt->setInt(1, iovID);
62  m_writeStmt->setInt(2, logicID);
63  m_writeStmt->setInt(3, item->getConfigId());
64 
65 
66  m_writeStmt->executeUpdate();
67  } catch (SQLException &e) {
68  throw(std::runtime_error(std::string("RunFEConfigDat::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 getLogicID() const
Definition: EcalLogicID.cc:41
int getConfigId() const
int fetchID() noexcept(false) override
Definition: RunIOV.cc:103

Friends And Related Function Documentation

friend class EcalCondDBInterface
friend

Definition at line 14 of file RunFEConfigDat.h.

Member Data Documentation

int RunFEConfigDat::m_config
private

Definition at line 35 of file RunFEConfigDat.h.

Referenced by getConfigId(), and setConfigId().