Logo ROOT   6.10/00
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 #include "TSQLResult.h"
16 
17 #include <vector>
18 
19 #if !defined(__CINT__)
20 #ifndef R__WIN32
21 #include <sys/time.h>
22 #endif
23 #include <occi.h>
24 #ifdef CONST
25 #undef CONST
26 #endif
27 #else
28 namespace oracle { namespace occi {
29 class Connection;
30 class Statement;
31 class ResultSet;
32 class MetaData;
33  }}
34 #endif
35 
36 class TList;
37 
38 class TOracleResult : public TSQLResult {
39 
40 private:
41  oracle::occi::Connection*fConn; // connection to Oracle
42  oracle::occi::Statement *fStmt; // executed statement
43  oracle::occi::ResultSet *fResult; // query result (rows)
44  std::vector<oracle::occi::MetaData> *fFieldInfo; // info for each field in the row
45  Int_t fFieldCount; // num of fields in resultset
46  UInt_t fUpdateCount; // for dml query, mutual exclusive with above
47  Int_t fResultType; // 0 - nothing; 1 - Select; 2 - table metainfo, 3 - update counter
48  TList *fPool; // array of results, produced when number of rows are requested
49  std::string fNameBuffer; // buffer for GetFieldName() argument
50 
51  Bool_t IsValid(Int_t field);
52 
53  TOracleResult(const TOracleResult&); // Not implemented;
54  TOracleResult &operator=(const TOracleResult&); // Not implemented;
55 
56 protected:
57  void initResultSet(oracle::occi::Statement *stmt);
58  void ProducePool();
59 
60 public:
61  TOracleResult(oracle::occi::Connection *conn, oracle::occi::Statement *stmt);
62  TOracleResult(oracle::occi::Connection *conn, const char *tableName);
64 
65  void Close(Option_t *opt="");
67  const char *GetFieldName(Int_t field);
68  virtual Int_t GetRowCount() const;
69  TSQLRow *Next();
70 
72 
73  ClassDef(TOracleResult,0) // Oracle query result
74 };
75 
76 #endif
TOracleResult(const TOracleResult &)
oracle::occi::ResultSet * fResult
Definition: TOracleResult.h:43
UInt_t fUpdateCount
Definition: TOracleResult.h:46
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:42
void Close(Option_t *opt="")
Close query result.
#define ClassDef(name, id)
Definition: Rtypes.h:297
Int_t GetUpdateCount()
Definition: TOracleResult.h:71
void initResultSet(oracle::occi::Statement *stmt)
Oracle query result.
Bool_t IsValid(Int_t field)
Check if result set is open and field index within range.
oracle::occi::Connection * fConn
Definition: TOracleResult.h:41
A doubly linked list.
Definition: TList.h:43
std::string fNameBuffer
Definition: TOracleResult.h:49
unsigned int UInt_t
Definition: RtypesCore.h:42
TSQLRow * Next()
Get next query result row.
std::vector< oracle::occi::MetaData > * fFieldInfo
Definition: TOracleResult.h:44
virtual Int_t GetRowCount() const
TOracleResult & operator=(const TOracleResult &)
Int_t GetFieldCount()
Get number of fields in result.
~TOracleResult()
Cleanup Oracle query result.