00001 // @(#)root/physics:$Id: TOracleServer.h 29321 2009-07-03 10:42:10Z brun $ 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_TOracleServer 00013 #define ROOT_TOracleServer 00014 00015 #ifndef ROOT_TSQLServer 00016 #include "TSQLServer.h" 00017 #endif 00018 00019 #if !defined(__CINT__) 00020 #ifndef R__WIN32 00021 #include <sys/time.h> 00022 #endif 00023 #include <occi.h> 00024 using namespace std; 00025 using namespace oracle::occi; 00026 #ifdef CONST 00027 #undef CONST 00028 #endif 00029 #else 00030 class Environment; 00031 class Connection; 00032 #endif 00033 00034 00035 class TOracleServer : public TSQLServer { 00036 00037 private: 00038 Environment *fEnv; // environment of Oracle access 00039 Connection *fConn; // connection to Oracle server 00040 TString fInfo; // info string with Oracle version information 00041 00042 static const char* fgDatimeFormat; //! format for converting date and time stamps into string 00043 00044 public: 00045 TOracleServer(const char *db, const char *uid, const char *pw); 00046 ~TOracleServer(); 00047 00048 void Close(Option_t *opt=""); 00049 TSQLResult *Query(const char *sql); 00050 Bool_t Exec(const char* sql); 00051 TSQLStatement *Statement(const char *sql, Int_t niter = 100); 00052 Bool_t IsConnected() const { return (fConn!=0) && (fEnv!=0); } 00053 Bool_t HasStatement() const { return kTRUE; } 00054 Int_t SelectDataBase(const char *dbname); 00055 TSQLResult *GetDataBases(const char *wild = 0); 00056 TSQLResult *GetTables(const char *dbname, const char *wild = 0); 00057 TList *GetTablesList(const char* wild = 0); 00058 TSQLTableInfo *GetTableInfo(const char* tablename); 00059 TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0); 00060 Int_t GetMaxIdentifierLength() { return 30; } 00061 Int_t CreateDataBase(const char *dbname); 00062 Int_t DropDataBase(const char *dbname); 00063 Int_t Reload(); 00064 Int_t Shutdown(); 00065 const char *ServerInfo(); 00066 00067 Bool_t StartTransaction(); 00068 Bool_t Commit(); 00069 Bool_t Rollback(); 00070 00071 static void SetDatimeFormat(const char* fmt = "MM/DD/YYYY, HH24:MI:SS"); 00072 static const char* GetDatimeFormat(); 00073 00074 ClassDef(TOracleServer,0) // Connection to Oracle server 00075 }; 00076 00077 #endif