Logo ROOT   6.10/00
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 #include "TSQLServer.h"
16 
17 #if !defined(__CINT__)
18 #ifndef R__WIN32
19 #include <sys/time.h>
20 #endif
21 #include <occi.h>
22 #ifdef CONST
23 #undef CONST
24 #endif
25 #else
26 namespace oracle { namespace occi {
27 class Environment;
28 class Connection;
29 }}
30 #endif
31 
32 
33 class TOracleServer : public TSQLServer {
34 
35 private:
36  oracle::occi::Environment *fEnv; // environment of Oracle access
37  oracle::occi::Connection *fConn; // connection to Oracle server
38  TString fInfo; // info string with Oracle version information
39 
40  static const char* fgDatimeFormat; //! format for converting date and time stamps into string
41 
42 public:
43  TOracleServer(const char *db, const char *uid, const char *pw);
45 
46  void Close(Option_t *opt="");
47  TSQLResult *Query(const char *sql);
48  Bool_t Exec(const char* sql);
49  TSQLStatement *Statement(const char *sql, Int_t niter = 100);
50  Bool_t IsConnected() const { return (fConn!=0) && (fEnv!=0); }
51  Bool_t HasStatement() const { return kTRUE; }
52  Int_t SelectDataBase(const char *dbname);
53  TSQLResult *GetDataBases(const char *wild = 0);
54  TSQLResult *GetTables(const char *dbname, const char *wild = 0);
55  TList *GetTablesList(const char* wild = 0);
56  TSQLTableInfo *GetTableInfo(const char* tablename);
57  TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
58  Int_t GetMaxIdentifierLength() { return 30; }
59  Int_t CreateDataBase(const char *dbname);
60  Int_t DropDataBase(const char *dbname);
61  Int_t Reload();
62  Int_t Shutdown();
63  const char *ServerInfo();
64 
66  Bool_t Commit();
67  Bool_t Rollback();
68 
69  static void SetDatimeFormat(const char* fmt = "MM/DD/YYYY, HH24:MI:SS");
70  static const char* GetDatimeFormat();
71 
72  ClassDef(TOracleServer,0) // Connection to Oracle server
73 };
74 
75 #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:51
TList * GetTablesList(const char *wild=0)
Return list of user tables Parameter wild specifies wildcard for table names.
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:129
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:36
Int_t Reload()
Reload permission tables.
Int_t DropDataBase(const char *dbname)
Drop (i.e.
#define ClassDef(name, id)
Definition: Rtypes.h:297
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:37
A doubly linked list.
Definition: TList.h:43
TSQLResult * GetTables(const char *dbname, const char *wild=0)
List all tables in the specified database.
Bool_t IsConnected() const
Definition: TOracleServer.h:50
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:58
static const char * fgDatimeFormat
Definition: TOracleServer.h:40
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 &quot;MM/DD/YYYY, HH24:MI:SS&quot;
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.
Bool_t StartTransaction()
Call Commit() to submit all chanes, done before.
Int_t CreateDataBase(const char *dbname)
Create a database.
const Bool_t kTRUE
Definition: RtypesCore.h:91