CMS 3D CMS Logo

IDataItem.h
Go to the documentation of this file.
1 #ifndef IDATAITEM_H
2 #define IDATAITEM_H
3 
8 
9 #include <stdexcept>
10 #include <map>
12 
16 class IDataItem : public IDBObject {
17 public:
18  IDataItem() : m_writeStmt(nullptr), m_readStmt(nullptr) {}
19 
20  virtual std::string getTable() = 0;
21 
22 protected:
23  oracle::occi::Statement* m_writeStmt;
24  oracle::occi::Statement* m_readStmt;
25 
26  inline void checkPrepare() noexcept(false) {
27  if (m_writeStmt == nullptr) {
28  throw(std::runtime_error("Write statement not prepared"));
29  }
30  }
31 
32  inline void terminateWriteStatement() noexcept(false) {
33  if (m_writeStmt != nullptr) {
34  m_conn->terminateStatement(m_writeStmt);
35  } else {
36  std::cout << "Warning from IDataItem: statement was aleady closed" << std::endl;
37  }
38  }
39 
40  inline void createReadStatement() noexcept(false) { m_readStmt = m_conn->createStatement(); }
41 
42  inline void setPrefetchRowCount(int ncount) noexcept(false) { m_readStmt->setPrefetchRowCount(ncount); }
43 
44  inline void terminateReadStatement() noexcept(false) {
45  if (m_readStmt != nullptr) {
46  m_conn->terminateStatement(m_readStmt);
47  } else {
48  std::cout << "Warning from IDataItem: statement was aleady closed" << std::endl;
49  }
50  }
51 
52  // Prepare a statement for writing operations
53  virtual void prepareWrite() noexcept(false) = 0;
54 };
55 
56 #endif
funct::false
false
Definition: Factorize.h:34
IDataItem::createReadStatement
void createReadStatement() noexcept(false)
Definition: IDataItem.h:40
IDataItem::getTable
virtual std::string getTable()=0
gather_cfg.cout
cout
Definition: gather_cfg.py:144
IDBObject
Definition: IDBObject.h:13
IDataItem::checkPrepare
void checkPrepare() noexcept(false)
Definition: IDataItem.h:26
IDataItem::m_readStmt
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:24
IDataItem::m_writeStmt
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:23
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
IDataItem
Definition: IDataItem.h:16
IDataItem::prepareWrite
virtual void prepareWrite() noexcept(false)=0
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
IDataItem::IDataItem
IDataItem()
Definition: IDataItem.h:18
IIOV.h
IDataItem::setPrefetchRowCount
void setPrefetchRowCount(int ncount) noexcept(false)
Definition: IDataItem.h:42
IDataItem::terminateReadStatement
void terminateReadStatement() noexcept(false)
Definition: IDataItem.h:44
EcalLogicID.h
IDBObject.h
Oracle.h
ITag.h
IDataItem::terminateWriteStatement
void terminateWriteStatement() noexcept(false)
Definition: IDataItem.h:32