Logo ROOT   6.14/05
Reference Guide
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 #include "TSQLServer.h"
16 
17 #include <ctime>
18 #include <WINDOWS.H>
19 #ifdef min
20 #undef min
21 #endif
22 #ifdef max
23 #undef max
24 #endif
25 #include <sql.h>
26 #include <sqlext.h>
27 
28 class TSapDBServer : public TSQLServer {
29 
30 private:
31  SQLHDBC fSapDB; // connection to SapDB server
32  SQLHENV fEnv; // environment for/of ODBC call
33  SQLHSTMT fStmt; // statement result set
34  SQLHSTMT fStmtCnt; // statement result set
35 
36  static Int_t printSQLError(SQLHDBC hdbc, SQLHSTMT hstmt);
37 
38 public:
39  TSapDBServer(const char *db, const char *uid, const char *pw);
40  ~TSapDBServer();
41 
42  void Close(Option_t *opt="");
43  TSQLResult *Query(const char *sql);
44  Int_t SelectDataBase(const char *dbname);
45  TSQLResult *GetDataBases(const char *wild = 0);
46  TSQLResult *GetTables(const char *dbname, const char *wild = 0);
47  TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
48  Int_t CreateDataBase(const char *dbname);
49  Int_t DropDataBase(const char *dbname);
50  Int_t Reload();
51  Int_t Shutdown();
52  const char *ServerInfo();
53 
54  ClassDef(TSapDBServer,0) // Connection to SapDB server
55 };
56 
57 #endif
SQLHDBC fSapDB
Definition: TSapDBServer.h:31
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:33
int Int_t
Definition: RtypesCore.h:41
const char * ServerInfo()
Return server info.
#define ClassDef(name, id)
Definition: Rtypes.h:320
Int_t Reload()
Reload permission tables.
TSapDBServer(const char *db, const char *uid, const char *pw)
Open a connection to a SapDB DB server.
SQLHENV fEnv
Definition: TSapDBServer.h:32
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:34
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.