test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RelationalOperation.h
Go to the documentation of this file.
1 #ifndef INCLUDE_ORA_RELATIONALOPERATION_H
2 #define INCLUDE_ORA_RELATIONALOPERATION_H
3 
4 // externals
5 #include "CoralBase/AttributeList.h"
6 #include "CoralBase/AttributeListSpecification.h"
7 //
8 #include <memory>
9 
10 namespace coral {
11  class ISchema;
12  class IBulkOperation;
13  class IQuery;
14  class ICursor;
15 }
16 
17 namespace ora {
18 
20  public:
21 
23  }
24 
25  virtual bool isRequired() = 0;
26 
27  virtual bool execute() = 0 ;
28 
29  virtual void reset() = 0;
30 
31  };
32 
33  typedef enum { Eq, Gt, Lt, Ge, Le } ConditionType;
34 
36  public:
37  virtual ~IRelationalData(){
38  }
39 
40  virtual int addId( const std::string& columnName ) = 0;
41 
42  virtual int addData( const std::string& columnName, const std::type_info& columnType ) = 0;
43 
44  virtual int addBlobData(const std::string& columnName) = 0;
45 
46  //virtual int addMetadata( const std::string& columnName, const std::type_info& columnType ) = 0;
47 
48  virtual int addWhereId( const std::string& columnName ) = 0;
49 
50  virtual coral::AttributeList& data() = 0;
51 
52  virtual coral::AttributeList& whereData() = 0;
53 
54  virtual std::string& whereClause() = 0;
55 
56 };
57 
59 
60  public:
61 
63 
64  virtual ~InputRelationalData();
65 
66  public:
67 
68  int addId(const std::string& columnName);
69 
70  int addData(const std::string& columnName, const std::type_info& columnType );
71 
72  int addBlobData(const std::string& columnName);
73 
74  int addWhereId( const std::string& columnName );
75 
76  coral::AttributeList& data();
77 
78  coral::AttributeList& whereData();
79 
81 
82  public:
83 
84  int addWhereId( const std::string& columnName, ConditionType cond );
85 
87 
88  private:
89 
90  coral::AttributeList m_data;
93  };
94 
96  public:
97  InsertOperation( const std::string& tableName, coral::ISchema& schema );
99 
100  public:
101  bool isRequired();
102  bool execute();
103  void reset();
104 
105  private:
107  coral::ISchema& m_schema;
108  };
109 
111  public:
112  BulkInsertOperation( const std::string& tableName, coral::ISchema& schema );
114  coral::IBulkOperation& setUp( int rowCacheSize );
115 
116  public:
117  bool isRequired();
118  bool execute();
119  void reset();
120  private:
122  coral::ISchema& m_schema;
123  std::vector<coral::IBulkOperation*> m_bulkOperations;
124  };
125 
127 
128  public:
129  explicit UpdateOperation( const std::string& tableName, coral::ISchema& schema );
131 
132  public:
133  bool isRequired();
134  bool execute();
135  void reset();
136  private:
138  coral::ISchema& m_schema;
139 
140  };
141 
142 
144  public:
145  explicit DeleteOperation( const std::string& tableName, coral::ISchema& schema );
147 
148  public:
149  bool isRequired();
150  bool execute();
151  void reset();
152  private:
154  coral::ISchema& m_schema;
155 
156  };
157 
158 
160  public:
161  explicit SelectOperation( const std::string& tableName, coral::ISchema& schema );
163 
164  void addOrderId(const std::string& columnName);
165  bool nextCursorRow();
166  void clear();
167  void execute();
168  coral::AttributeListSpecification& attributeListSpecification();
169 
170  public:
171  int addId(const std::string& columnName);
172 
173  int addData(const std::string& columnName, const std::type_info& columnType );
174 
175  int addBlobData(const std::string& columnName);
176 
177  //int addMetadata( const std::string& columnName, const std::type_info& columnType );
178 
179  int addWhereId( const std::string& columnName );
180 
181  coral::AttributeList& data();
182  coral::AttributeList& whereData();
184  private:
185  coral::AttributeListSpecification* m_spec;
186  coral::AttributeList m_whereData;
188  std::vector<std::string> m_orderByCols;
189  std::auto_ptr<coral::IQuery> m_query;
190  coral::ICursor* m_cursor;
192  coral::ISchema& m_schema;
193  };
194 
195 }
196 
197 #endif
int addWhereId(const std::string &columnName)
std::auto_ptr< coral::IQuery > m_query
virtual coral::AttributeList & whereData()=0
coral::ISchema & m_schema
int addData(const std::string &columnName, const std::type_info &columnType)
virtual int addWhereId(const std::string &columnName)=0
coral::AttributeListSpecification & attributeListSpecification()
int addData(const std::string &columnName, const std::type_info &columnType)
coral::AttributeList & whereData()
tuple schema
Definition: dataDML.py:2334
UpdateOperation(const std::string &tableName, coral::ISchema &schema)
virtual int addData(const std::string &columnName, const std::type_info &columnType)=0
BulkInsertOperation(const std::string &tableName, coral::ISchema &schema)
SelectOperation(const std::string &tableName, coral::ISchema &schema)
InsertOperation(const std::string &tableName, coral::ISchema &schema)
virtual int addBlobData(const std::string &columnName)=0
int addWhereId(const std::string &columnName)
coral::IBulkOperation & setUp(int rowCacheSize)
virtual std::string & whereClause()=0
virtual bool execute()=0
DeleteOperation(const std::string &tableName, coral::ISchema &schema)
coral::AttributeListSpecification * m_spec
coral::AttributeList & data()
virtual void reset()=0
int addId(const std::string &columnName)
int addBlobData(const std::string &columnName)
void addOrderId(const std::string &columnName)
coral::AttributeList & data()
virtual coral::AttributeList & data()=0
std::vector< coral::IBulkOperation * > m_bulkOperations
coral::AttributeList & whereData()
coral::ISchema & m_schema
coral::ICursor * m_cursor
virtual bool isRequired()=0
coral::ISchema & m_schema
int addId(const std::string &columnName)
coral::AttributeList m_whereData
int addBlobData(const std::string &columnName)
virtual int addId(const std::string &columnName)=0
coral::ISchema & m_schema
coral::AttributeList m_data
std::vector< std::string > m_orderByCols