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