ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TOracleServer.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_TOracleServer
13 #define ROOT_TOracleServer
14 
15 #ifndef ROOT_TSQLServer
16 #include "TSQLServer.h"
17 #endif
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
28 namespace oracle { namespace occi {
29 class Environment;
30 class Connection;
31 }}
32 #endif
33 
34 
35 class TOracleServer : public TSQLServer {
36 
37 private:
38  oracle::occi::Environment *fEnv; // environment of Oracle access
39  oracle::occi::Connection *fConn; // connection to Oracle server
40  TString fInfo; // info string with Oracle version information
41 
42  static const char* fgDatimeFormat; //! format for converting date and time stamps into string
43 
44 public:
45  TOracleServer(const char *db, const char *uid, const char *pw);
47 
48  void Close(Option_t *opt="");
49  TSQLResult *Query(const char *sql);
50  Bool_t Exec(const char* sql);
51  TSQLStatement *Statement(const char *sql, Int_t niter = 100);
52  Bool_t IsConnected() const { return (fConn!=0) && (fEnv!=0); }
53  Bool_t HasStatement() const { return kTRUE; }
54  Int_t SelectDataBase(const char *dbname);
55  TSQLResult *GetDataBases(const char *wild = 0);
56  TSQLResult *GetTables(const char *dbname, const char *wild = 0);
57  TList *GetTablesList(const char* wild = 0);
58  TSQLTableInfo *GetTableInfo(const char* tablename);
59  TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
60  Int_t GetMaxIdentifierLength() { return 30; }
61  Int_t CreateDataBase(const char *dbname);
62  Int_t DropDataBase(const char *dbname);
63  Int_t Reload();
64  Int_t Shutdown();
65  const char *ServerInfo();
66 
68  Bool_t Commit();
69  Bool_t Rollback();
70 
71  static void SetDatimeFormat(const char* fmt = "MM/DD/YYYY, HH24:MI:SS");
72  static const char* GetDatimeFormat();
73 
74  ClassDef(TOracleServer,0) // Connection to Oracle server
75 };
76 
77 #endif
TOracleServer(const char *db, const char *uid, const char *pw)
format for converting date and time stamps into string
Bool_t Commit()
Commits all changes made since the previous Commit() or Rollback() Return kTRUE if OK...
Bool_t HasStatement() const
Definition: TOracleServer.h:53
TList * GetTablesList(const char *wild=0)
Return list of user tables Parameter wild specifies wildcard for table names.
const char * dbname
Definition: sqlcanvas.C:7
const char Option_t
Definition: RtypesCore.h:62
TSQLTableInfo * GetTableInfo(const char *tablename)
Produces SQL table info Object must be deleted by user.
Basic string class.
Definition: TString.h:137
Bool_t Exec(const char *sql)
Execute sql command wich does not produce any result set.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
oracle::occi::Environment * fEnv
Definition: TOracleServer.h:38
Int_t Reload()
Reload permission tables.
Int_t DropDataBase(const char *dbname)
Drop (i.e.
#define ClassDef(name, id)
Definition: Rtypes.h:254
void Close(Option_t *opt="")
Close connection to Oracle DB server.
Int_t SelectDataBase(const char *dbname)
Select a database.
oracle::occi::Connection * fConn
Definition: TOracleServer.h:39
A doubly linked list.
Definition: TList.h:47
TSQLResult * GetTables(const char *dbname, const char *wild=0)
List all tables in the specified database.
Bool_t IsConnected() const
Definition: TOracleServer.h:52
TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=0)
List all columns in specified table in the specified database.
Bool_t Rollback()
Drops all changes made since the previous Commit() or Rollback() Return kTRUE if OK.
~TOracleServer()
Close connection to Oracle DB server.
TSQLStatement * Statement(const char *sql, Int_t niter=100)
TSQLResult * Query(const char *sql)
Execute SQL command.
const char * ServerInfo()
Return Oracle server version info.
Int_t GetMaxIdentifierLength()
Definition: TOracleServer.h:60
static const char * fgDatimeFormat
Definition: TOracleServer.h:42
static void SetDatimeFormat(const char *fmt="MM/DD/YYYY, HH24:MI:SS")
set format for converting timestamps or date field into string default value is "MM/DD/YYYY, HH24:MI:SS"
Int_t Shutdown()
Shutdown the database server.
static const char * GetDatimeFormat()
return value of actul convertion format from timestamps or date to string
TSQLResult * GetDataBases(const char *wild=0)
List all available databases.
const Bool_t kTRUE
Definition: Rtypes.h:91
Bool_t StartTransaction()
Call Commit() to submit all chanes, done before.
Int_t CreateDataBase(const char *dbname)
Create a database.