00001 // @(#)root/physics:$Id: TOracleResult.h 23102 2008-04-09 22:18:41Z pcanal $ 00002 // Author: Yan Liu and Shaowen Wang 23/11/04 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TOracleResult 00013 #define ROOT_TOracleResult 00014 00015 #ifndef ROOT_TSQLResult 00016 #include "TSQLResult.h" 00017 #endif 00018 00019 #include <vector> 00020 00021 #if !defined(__CINT__) 00022 #ifndef R__WIN32 00023 #include <sys/time.h> 00024 #endif 00025 #include <occi.h> 00026 using namespace oracle::occi; 00027 #ifdef CONST 00028 #undef CONST 00029 #endif 00030 #else 00031 class Connection; 00032 class Statement; 00033 class ResultSet; 00034 class MetaData; 00035 #endif 00036 00037 class TList; 00038 00039 class TOracleResult : public TSQLResult { 00040 00041 private: 00042 Connection *fConn; // connection to Oracle 00043 Statement *fStmt; // executed statement 00044 ResultSet *fResult; // query result (rows) 00045 std::vector<MetaData> *fFieldInfo; // info for each field in the row 00046 Int_t fFieldCount; // num of fields in resultset 00047 UInt_t fUpdateCount; // for dml query, mutual exclusive with above 00048 Int_t fResultType; // 0 - nothing; 1 - Select; 2 - table metainfo, 3 - update counter 00049 TList *fPool; // array of results, produced when number of rows are requested 00050 std::string fNameBuffer; // buffer for GetFieldName() argument 00051 00052 Bool_t IsValid(Int_t field); 00053 00054 protected: 00055 void initResultSet(Statement *stmt); 00056 void ProducePool(); 00057 00058 public: 00059 TOracleResult(Connection *conn, Statement *stmt); 00060 TOracleResult(Connection *conn, const char *tableName); 00061 ~TOracleResult(); 00062 00063 void Close(Option_t *opt=""); 00064 Int_t GetFieldCount(); 00065 const char *GetFieldName(Int_t field); 00066 virtual Int_t GetRowCount() const; 00067 TSQLRow *Next(); 00068 00069 Int_t GetUpdateCount() { return fUpdateCount; } 00070 00071 ClassDef(TOracleResult,0) // Oracle query result 00072 }; 00073 00074 #endif