CMS 3D CMS Logo

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

#include <ODCCSCycle.h>

Inheritance diagram for ODCCSCycle:
IODConfig IDBObject

Public Member Functions

int getCCSConfigurationID () const
 
int getId () const
 
std::string getTable () override
 
 ODCCSCycle ()
 
bool operator!= (const ODCCSCycle &m) const
 
bool operator== (const ODCCSCycle &m) const
 
void setCCSConfigurationID (int x)
 
void setId (int id)
 
 ~ODCCSCycle () override
 
- Public Member Functions inherited from IODConfig
std::string getConfigTag ()
 
void setConfigTag (std::string x)
 
- 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 clear ()
 
void fetchData (ODCCSCycle *result) noexcept(false)
 
int fetchID () noexcept(false)
 
void insertConfig () noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void setByID (int id) noexcept(false)
 
void writeDB () noexcept(false)
 

Private Attributes

int m_ccs_config_id
 
int m_ID
 

Friends

class EcalCondDBInterface
 
class ODEcalCycle
 

Additional Inherited Members

- Public Types inherited from IODConfig
typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 
- Public Attributes inherited from IODConfig
std::string m_config_tag
 
- Static Public Attributes inherited from IDBObject
static const int ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IODConfig
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
unsigned char * readClob (Clob &clob, int size) 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 IODConfig
Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 9 of file ODCCSCycle.h.

Constructor & Destructor Documentation

◆ ODCCSCycle()

ODCCSCycle::ODCCSCycle ( )

Definition at line 9 of file ODCCSCycle.cc.

9  {
10  m_env = nullptr;
11  m_conn = nullptr;
12  m_writeStmt = nullptr;
13  m_readStmt = nullptr;
14  //
15  m_ID = 0;
16  m_ccs_config_id = 0;
17 }

◆ ~ODCCSCycle()

ODCCSCycle::~ODCCSCycle ( )
override

Definition at line 19 of file ODCCSCycle.cc.

19 {}

Member Function Documentation

◆ clear()

void ODCCSCycle::clear ( void  )
private

Definition at line 54 of file ODCCSCycle.cc.

54 { m_ccs_config_id = 0; }

◆ fetchData()

void ODCCSCycle::fetchData ( ODCCSCycle result)
privatenoexcept

Definition at line 109 of file ODCCSCycle.cc.

109  {
110  this->checkConnection();
111  result->clear();
112 
113  if (result->getId() == 0) {
114  throw(std::runtime_error("ODCCSConfig::fetchData(): no Id defined for this ODCCSConfig "));
115  }
116 
117  try {
118  m_readStmt->setSQL(
119  "SELECT ccs_configuration_id FROM ecal_ccs_cycle "
120  "WHERE cycle_id = :1 ");
121 
122  m_readStmt->setInt(1, result->getId());
123  ResultSet *rset = m_readStmt->executeQuery();
124 
125  rset->next();
126 
127  result->setCCSConfigurationID(rset->getInt(1));
128 
129  } catch (SQLException &e) {
130  throw(std::runtime_error("ODCCSCycle::fetchData(): " + e.getMessage()));
131  }
132 }

References MillePedeFileConverter_cfg::e, and mps_fire::result.

◆ fetchID()

int ODCCSCycle::fetchID ( )
privatenoexcept

Definition at line 56 of file ODCCSCycle.cc.

56  {
57  // Return from memory if available
58  if (m_ID) {
59  return m_ID;
60  }
61 
62  this->checkConnection();
63 
64  try {
65  Statement *stmt = m_conn->createStatement();
66  stmt->setSQL(
67  "SELECT cycle_id, ccs_configuration_id FROM ecal_ccs_cycle "
68  "WHERE cycle_id = :1 ");
69  stmt->setInt(1, m_ID);
70  ResultSet *rset = stmt->executeQuery();
71 
72  if (rset->next()) {
73  m_ID = rset->getInt(1);
74  m_ccs_config_id = rset->getInt(2);
75  } else {
76  m_ID = 0;
77  }
78  m_conn->terminateStatement(stmt);
79  } catch (SQLException &e) {
80  throw(std::runtime_error("ODCCSCycle::fetchID: " + e.getMessage()));
81  }
82 
83  return m_ID;
84 }

References MillePedeFileConverter_cfg::e.

◆ getCCSConfigurationID()

int ODCCSCycle::getCCSConfigurationID ( ) const
inline

Definition at line 24 of file ODCCSCycle.h.

24 { return m_ccs_config_id; }

References m_ccs_config_id.

◆ getId()

int ODCCSCycle::getId ( void  ) const
inline

Definition at line 20 of file ODCCSCycle.h.

20 { return m_ID; };

References m_ID.

◆ getTable()

std::string ODCCSCycle::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 17 of file ODCCSCycle.h.

17 { return "ECAL_CCS_CYCLE"; }

◆ insertConfig()

void ODCCSCycle::insertConfig ( )
privatenoexcept

Definition at line 134 of file ODCCSCycle.cc.

134  {
135  try {
136  prepareWrite();
137  writeDB();
139  } catch (SQLException &e) {
140  throw(std::runtime_error("EcalCondDBInterface::insertDataSet: Unknown exception caught"));
141  }
142 }

References MillePedeFileConverter_cfg::e, and GlobalTrackerMuonAlignment_cfi::writeDB.

Referenced by ODEcalCycle::writeDB().

◆ operator!=()

bool ODCCSCycle::operator!= ( const ODCCSCycle m) const
inline

Definition at line 28 of file ODCCSCycle.h.

28 { return !(*this == m); }

References visualization-live-secondInstance_cfg::m.

◆ operator==()

bool ODCCSCycle::operator== ( const ODCCSCycle m) const
inline

Definition at line 27 of file ODCCSCycle.h.

27 { return (m_ID == m.m_ID); }

References visualization-live-secondInstance_cfg::m, and m_ID.

◆ prepareWrite()

void ODCCSCycle::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 21 of file ODCCSCycle.cc.

21  {
22  this->checkConnection();
23 
24  try {
25  m_writeStmt = m_conn->createStatement();
26  m_writeStmt->setSQL(
27  "INSERT INTO ECAL_CCS_Cycle (cycle_id, ccs_configuration_id ) "
28  "VALUES (:1, :2 )");
29  } catch (SQLException &e) {
30  throw(std::runtime_error("ODCCSCycle::prepareWrite(): " + e.getMessage()));
31  }
32 }

References MillePedeFileConverter_cfg::e.

◆ setByID()

void ODCCSCycle::setByID ( int  id)
privatenoexcept

Definition at line 86 of file ODCCSCycle.cc.

86  {
87  this->checkConnection();
88 
89  try {
90  Statement *stmt = m_conn->createStatement();
91  stmt->setSQL(
92  "SELECT cycle_id, ccs_configuration_id FROM ecal_ccs_cycle "
93  "WHERE cycle_id = :1 ");
94  stmt->setInt(1, id);
95  ResultSet *rset = stmt->executeQuery();
96 
97  if (rset->next()) {
98  m_ID = rset->getInt(1);
99  m_ccs_config_id = rset->getInt(2);
100  } else {
101  m_ID = 0;
102  }
103  m_conn->terminateStatement(stmt);
104  } catch (SQLException &e) {
105  throw(std::runtime_error("ODCCSCycle::fetchID: " + e.getMessage()));
106  }
107 }

References MillePedeFileConverter_cfg::e.

◆ setCCSConfigurationID()

void ODCCSCycle::setCCSConfigurationID ( int  x)
inline

Definition at line 23 of file ODCCSCycle.h.

23 { m_ccs_config_id = x; }

References m_ccs_config_id, and x.

Referenced by ODEcalCycle::writeDB().

◆ setId()

void ODCCSCycle::setId ( int  id)
inline

Definition at line 19 of file ODCCSCycle.h.

19 { m_ID = id; }

References triggerObjects_cff::id, and m_ID.

Referenced by ODEcalCycle::writeDB().

◆ writeDB()

void ODCCSCycle::writeDB ( )
privatenoexcept

Definition at line 34 of file ODCCSCycle.cc.

34  {
35  this->checkConnection();
36  this->checkPrepare();
37 
38  try {
39  m_writeStmt->setInt(1, this->getId());
40  m_writeStmt->setInt(2, this->getCCSConfigurationID());
41 
42  m_writeStmt->executeUpdate();
43 
44  } catch (SQLException &e) {
45  throw(std::runtime_error("ODCCSCycle::writeDB: " + e.getMessage()));
46  }
47 
48  // Now get the ID
49  if (!this->fetchID()) {
50  throw(std::runtime_error("ODCCSCycle::writeDB: Failed to write"));
51  }
52 }

References MillePedeFileConverter_cfg::e, and getId().

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 11 of file ODCCSCycle.h.

◆ ODEcalCycle

friend class ODEcalCycle
friend

Definition at line 12 of file ODCCSCycle.h.

Member Data Documentation

◆ m_ccs_config_id

int ODCCSCycle::m_ccs_config_id
private

Definition at line 33 of file ODCCSCycle.h.

Referenced by getCCSConfigurationID(), and setCCSConfigurationID().

◆ m_ID

int ODCCSCycle::m_ID
private

Definition at line 32 of file ODCCSCycle.h.

Referenced by getId(), operator==(), and setId().

IODConfig::Statement
oracle::occi::Statement Statement
Definition: IODConfig.h:21
DDAxes::x
ODCCSCycle::fetchID
int fetchID() noexcept(false)
Definition: ODCCSCycle.cc:56
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODCCSCycle::getId
int getId() const
Definition: ODCCSCycle.h:20
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
IODConfig::checkPrepare
void checkPrepare() noexcept(false)
Definition: IODConfig.h:36
ODCCSCycle::prepareWrite
void prepareWrite() noexcept(false) override
Definition: ODCCSCycle.cc:21
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
ODCCSCycle::m_ID
int m_ID
Definition: ODCCSCycle.h:32
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
ODCCSCycle::getCCSConfigurationID
int getCCSConfigurationID() const
Definition: ODCCSCycle.h:24
ODCCSCycle::m_ccs_config_id
int m_ccs_config_id
Definition: ODCCSCycle.h:33
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
IODConfig::terminateWriteStatement
void terminateWriteStatement() noexcept(false)
Definition: IODConfig.h:42
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
mps_fire.result
result
Definition: mps_fire.py:303
ODCCSCycle::clear
void clear()
Definition: ODCCSCycle.cc:54
ODCCSCycle::writeDB
void writeDB() noexcept(false)
Definition: ODCCSCycle.cc:34
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37