ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TSapDBServer.h
Go to the documentation of this file.
1 // @(#)root/sapdb:$Id$
2 // Author: Mark Hemberger & Fons Rademakers 03/08/2001
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2001, 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_TSapDBServer
13 #define ROOT_TSapDBServer
14 
15 #ifndef ROOT_TSQLServer
16 #include "TSQLServer.h"
17 #endif
18 
19 #include <ctime>
20 #include <WINDOWS.H>
21 #ifdef min
22 #undef min
23 #endif
24 #ifdef max
25 #undef max
26 #endif
27 #include <sql.h>
28 #include <sqlext.h>
29 
30 class TSapDBServer : public TSQLServer {
31 
32 private:
33  SQLHDBC fSapDB; // connection to SapDB server
34  SQLHENV fEnv; // environment for/of ODBC call
35  SQLHSTMT fStmt; // statement result set
36  SQLHSTMT fStmtCnt; // statement result set
37 
38  static Int_t printSQLError(SQLHDBC hdbc, SQLHSTMT hstmt);
39 
40 public:
41  TSapDBServer(const char *db, const char *uid, const char *pw);
42  ~TSapDBServer();
43 
44  void Close(Option_t *opt="");
45  TSQLResult *Query(const char *sql);
46  Int_t SelectDataBase(const char *dbname);
47  TSQLResult *GetDataBases(const char *wild = 0);
48  TSQLResult *GetTables(const char *dbname, const char *wild = 0);
49  TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
50  Int_t CreateDataBase(const char *dbname);
51  Int_t DropDataBase(const char *dbname);
52  Int_t Reload();
53  Int_t Shutdown();
54  const char *ServerInfo();
55 
56  ClassDef(TSapDBServer,0) // Connection to SapDB server
57 };
58 
59 #endif
SQLHDBC fSapDB
Definition: TSapDBServer.h:33
const char * dbname
Definition: sqlcanvas.C:7
TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=0)
List all columns in specified table in the specified database.
const char Option_t
Definition: RtypesCore.h:62
TSQLResult * GetDataBases(const char *wild=0)
List all available databases.
SQLHSTMT fStmt
Definition: TSapDBServer.h:35
int Int_t
Definition: RtypesCore.h:41
const char * ServerInfo()
Return server info.
#define ClassDef(name, id)
Definition: Rtypes.h:254
Int_t Reload()
Reload permission tables.
TSapDBServer(const char *db, const char *uid, const char *pw)
SQLHENV fEnv
Definition: TSapDBServer.h:34
Int_t SelectDataBase(const char *dbname)
Select a database.
void Close(Option_t *opt="")
Close connection to SapDB DB server.
Int_t CreateDataBase(const char *dbname)
Create a database.
SQLHSTMT fStmtCnt
Definition: TSapDBServer.h:36
Int_t DropDataBase(const char *dbname)
Drop (i.e.
TSQLResult * GetTables(const char *dbname, const char *wild=0)
List all tables in the specified database.
TSQLResult * Query(const char *sql)
Execute SQL command.
Int_t Shutdown()
Shutdown the database server.
~TSapDBServer()
Close connection to SapDB DB server.
static Int_t printSQLError(SQLHDBC hdbc, SQLHSTMT hstmt)
Print SapDB error message.