Logo ROOT  
Reference Guide
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
28namespace oracle { namespace occi {
29class Connection;
30class Statement;
31class ResultSet;
32class MetaData;
33 }}
34#endif
35
36class TList;
37
38class TOracleResult : public TSQLResult {
39
40private:
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
56protected:
57 void initResultSet(oracle::occi::Statement *stmt);
58 void ProducePool();
59
60public:
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
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
bool Bool_t
Definition: RtypesCore.h:59
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
A doubly linked list.
Definition: TList.h:44
UInt_t fUpdateCount
Definition: TOracleResult.h:46
Bool_t IsValid(Int_t field)
Check if result set is open and field index within range.
TSQLRow * Next()
Get next query result row.
oracle::occi::Statement * fStmt
Definition: TOracleResult.h:42
std::vector< oracle::occi::MetaData > * fFieldInfo
Definition: TOracleResult.h:44
virtual Int_t GetRowCount() const
TOracleResult(oracle::occi::Connection *conn, const char *tableName)
void initResultSet(oracle::occi::Statement *stmt)
Oracle query result.
TOracleResult & operator=(const TOracleResult &)
~TOracleResult()
Cleanup Oracle query result.
const char * GetFieldName(Int_t field)
Get name of specified field.
Int_t GetUpdateCount()
Definition: TOracleResult.h:71
Int_t GetFieldCount()
Get number of fields in result.
oracle::occi::Connection * fConn
Definition: TOracleResult.h:41
TOracleResult(oracle::occi::Connection *conn, oracle::occi::Statement *stmt)
std::string fNameBuffer
Definition: TOracleResult.h:49
oracle::occi::ResultSet * fResult
Definition: TOracleResult.h:43
void Close(Option_t *opt="")
Close query result.
TOracleResult(const TOracleResult &)