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