FEDRA emulsion software from the OPERA Collaboration
TOracleServer.h
Go to the documentation of this file.
1 // @(#)root/physics:$Name: not supported by cvs2svn $:$Id: TOracleServer.h,v 1.5 2007-08-31 12:14:00 valeri Exp $
2 // Author: Yan Liu and Shaowen Wang 23/11/04
3 // Modified and adopted to OPERA by Valeri Tioukov
4 
5 /*************************************************************************
6  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
7  * All rights reserved. *
8  * *
9  * For the licensing terms see $ROOTSYS/LICENSE. *
10  * For the list of contributors see $ROOTSYS/README/CREDITS. *
11  *************************************************************************/
12 
13 #ifndef ROOT_TOracleServer
14 #define ROOT_TOracleServer
15 
16 #ifndef ROOT_TSQLServer
17 #include "TSQLServer.h"
18 #endif
19 
20 #if !defined(__CINT__)
21 #ifndef R__WIN32
22 #include <sys/time.h>
23 #endif
24 #include <occi.h>
25 #include "RVersion.h"
26 
27 using namespace std;
28 using namespace oracle::occi;
29 #else
30 class Environment;
31 class Connection;
32 class Statement;
33 #endif
34 
35 class TTree;
36 class TString;
37 
38 class TOracleServer : public TSQLServer {
39 
40  friend class TOracleServerE;
41  friend class TOracleServerE2;
42  friend class TOracleServerE2W;
43  friend class TOracleServerE2WX;
44  friend class TOracleServerE2WFB;
45 
46 private:
47  Environment *fEnv; // environment of Oracle access
48  Connection *fConn; // connection to Oracle server
49 
50 #if !defined(__CINT__)
51 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,11,0)
52  oracle::occi::Statement *fStmt; // reusable statement object
53 #else
54  Statement *fStmt; // reusable statement object
55 #endif
56 #else
57  Statement *fStmt; // reusable statement object
58 #endif
59 
60 public:
61  TOracleServer(const char *db, const char *uid, const char *pw);
63 
64  void Close(Option_t *opt="");
65  TSQLResult *Query(const char *sql);
66  Int_t SelectDataBase(const char *dbname);
67  TSQLResult *GetDataBases(const char *wild = 0);
68  TSQLResult *GetTables(const char *dbname, const char *wild = 0);
69  TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
70  Int_t CreateDataBase(const char *dbname);
71  Int_t DropDataBase(const char *dbname);
72  Int_t Reload();
73  Int_t Shutdown();
74  const char *ServerInfo();
75 
76  // new functions in respect to basic root class (VT)
77  Int_t QueryTree(char *query, TTree *tree, char *leafs=0);
78  Int_t PrintResult();
79  Int_t PrintResultStr( TString &result );
80 
81  ClassDef(TOracleServer,0) // Connection to Oracle server
82 };
83 
84 #endif
Definition: TOracleServerE2WFB.h:14
Definition: TOracleServerE2WX.h:14
Definition: TOracleServerE2W.h:12
Definition: TOracleServerE2.h:13
Definition: TOracleServerE.h:10
Definition: TOracleServer.h:38
Int_t Reload()
Definition: TOracleServer.cxx:277
Connection * fConn
Definition: TOracleServer.h:48
TSQLResult * Query(const char *sql)
Definition: TOracleServer.cxx:97
Environment * fEnv
Definition: TOracleServer.h:47
oracle::occi::Statement * fStmt
Definition: TOracleServer.h:52
Int_t CreateDataBase(const char *dbname)
Definition: TOracleServer.cxx:249
~TOracleServer()
Definition: TOracleServer.cxx:68
const char * ServerInfo()
Definition: TOracleServer.cxx:305
Int_t DropDataBase(const char *dbname)
Definition: TOracleServer.cxx:262
Int_t PrintResult()
Definition: TOracleServer.cxx:393
Int_t QueryTree(char *query, TTree *tree, char *leafs=0)
Definition: TOracleServer.cxx:318
TSQLResult * GetTables(const char *dbname, const char *wild=0)
Definition: TOracleServer.cxx:168
Int_t PrintResultStr(TString &result)
Definition: TOracleServer.cxx:431
TSQLResult * GetDataBases(const char *wild=0)
Definition: TOracleServer.cxx:232
TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=0)
Definition: TOracleServer.cxx:196
Int_t SelectDataBase(const char *dbname)
Definition: TOracleServer.cxx:217
TOracleServer(const char *db, const char *uid, const char *pw)
Int_t Shutdown()
Definition: TOracleServer.cxx:291
const char * opt
Definition: mc2raw.cxx:42
TOracleServerE * db
Definition: test_oracle.C:8
file Close()