ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TOracleResult.h
Go to the documentation of this file.
1 // @(#)root/physics:$Id$
2 // Author: Yan Liu and Shaowen Wang 23/11/04
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TOracleResult
13 #define ROOT_TOracleResult
14 
15 #ifndef ROOT_TSQLResult
16 #include "TSQLResult.h"
17 #endif
18 
19 #include <vector>
20 
21 #if !defined(__CINT__)
22 #ifndef R__WIN32
23 #include <sys/time.h>
24 #endif
25 #include <occi.h>
26 #ifdef CONST
27 #undef CONST
28 #endif
29 #else
30 namespace oracle { namespace occi {
31 class Connection;
32 class Statement;
33 class ResultSet;
34 class MetaData;
35  }}
36 #endif
37 
38 class TList;
39 
40 class TOracleResult : public TSQLResult {
41 
42 private:
43  oracle::occi::Connection*fConn; // connection to Oracle
44  oracle::occi::Statement *fStmt; // executed statement
45  oracle::occi::ResultSet *fResult; // query result (rows)
46  std::vector<oracle::occi::MetaData> *fFieldInfo; // info for each field in the row
47  Int_t fFieldCount; // num of fields in resultset
48  UInt_t fUpdateCount; // for dml query, mutual exclusive with above
49  Int_t fResultType; // 0 - nothing; 1 - Select; 2 - table metainfo, 3 - update counter
50  TList *fPool; // array of results, produced when number of rows are requested
51  std::string fNameBuffer; // buffer for GetFieldName() argument
52 
53  Bool_t IsValid(Int_t field);
54 
55  TOracleResult(const TOracleResult&); // Not implemented;
56  TOracleResult &operator=(const TOracleResult&); // Not implemented;
57 
58 protected:
59  void initResultSet(oracle::occi::Statement *stmt);
60  void ProducePool();
61 
62 public:
63  TOracleResult(oracle::occi::Connection *conn, oracle::occi::Statement *stmt);
64  TOracleResult(oracle::occi::Connection *conn, const char *tableName);
66 
67  void Close(Option_t *opt="");
69  const char *GetFieldName(Int_t field);
70  virtual Int_t GetRowCount() const;
71  TSQLRow *Next();
72 
74 
75  ClassDef(TOracleResult,0) // Oracle query result
76 };
77 
78 #endif
TOracleResult(const TOracleResult &)
oracle::occi::ResultSet * fResult
Definition: TOracleResult.h:45
UInt_t fUpdateCount
Definition: TOracleResult.h:48
const char Option_t
Definition: RtypesCore.h:62
const char * GetFieldName(Int_t field)
Get name of specified field.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
oracle::occi::Statement * fStmt
Definition: TOracleResult.h:44
void Close(Option_t *opt="")
Close query result.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Int_t GetUpdateCount()
Definition: TOracleResult.h:73
void initResultSet(oracle::occi::Statement *stmt)
Bool_t IsValid(Int_t field)
Check if result set is open and field index within range.
oracle::occi::Connection * fConn
Definition: TOracleResult.h:43
A doubly linked list.
Definition: TList.h:47
std::string fNameBuffer
Definition: TOracleResult.h:51
unsigned int UInt_t
Definition: RtypesCore.h:42
TSQLRow * Next()
Get next query result row.
std::vector< oracle::occi::MetaData > * fFieldInfo
Definition: TOracleResult.h:46
virtual Int_t GetRowCount() const
TOracleResult & operator=(const TOracleResult &)
Int_t GetFieldCount()
Get number of fields in result.
~TOracleResult()
Cleanup Oracle query result.