CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
18  public:
20  : m_writeStmt(0),
21  m_readStmt(0)
22  {}
23 
24  virtual std::string getTable() =0;
25 
26 
27  protected:
28  oracle::occi::Statement* m_writeStmt;
29  oracle::occi::Statement* m_readStmt;
30 
31  inline void checkPrepare()
32  throw(std::runtime_error)
33  {
34  if (m_writeStmt == NULL) {
35  throw(std::runtime_error("Write statement not prepared"));
36  }
37  }
38 
40  throw(std::runtime_error)
41  {
42  if (m_writeStmt != NULL) {
43  m_conn->terminateStatement(m_writeStmt);
44  } else {
45  std::cout << "Warning from IDataItem: statement was aleady closed"<< std::endl;
46  }
47  }
48 
49 
50  inline void createReadStatement()
51  throw(std::runtime_error)
52  {
53  m_readStmt=m_conn->createStatement();
54  }
55 
56  inline void setPrefetchRowCount(int ncount)
57  throw(std::runtime_error)
58  {
59  m_readStmt->setPrefetchRowCount(ncount);
60  }
61 
62  inline void terminateReadStatement()
63  throw(std::runtime_error)
64  {
65  if (m_readStmt != NULL) {
66  m_conn->terminateStatement(m_readStmt);
67  } else {
68  std::cout << "Warning from IDataItem: statement was aleady closed"<< std::endl;
69  }
70  }
71 
72 
73 
74  // Prepare a statement for writing operations
75  virtual void prepareWrite()
76  throw(std::runtime_error) =0;
77 
78 
79 };
80 
81 #endif
oracle::occi::Statement * m_writeStmt
Definition: IDataItem.h:28
oracle::occi::Connection * m_conn
Definition: IDBObject.h:39
void setPrefetchRowCount(int ncount)
Definition: IDataItem.h:56
#define NULL
Definition: scimark2.h:8
void terminateReadStatement()
Definition: IDataItem.h:62
void createReadStatement()
Definition: IDataItem.h:50
virtual void prepareWrite()=0
void terminateWriteStatement()
Definition: IDataItem.h:39
oracle::occi::Statement * m_readStmt
Definition: IDataItem.h:29
void checkPrepare()
Definition: IDataItem.h:31
virtual std::string getTable()=0
IDataItem()
Definition: IDataItem.h:19
tuple cout
Definition: gather_cfg.py:145