00001 // @(#)root/sapdb:$Id: TSapDBServer.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Mark Hemberger & Fons Rademakers 03/08/2001 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2001, 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_TSapDBServer 00013 #define ROOT_TSapDBServer 00014 00015 #ifndef ROOT_TSQLServer 00016 #include "TSQLServer.h" 00017 #endif 00018 00019 #if !defined(__CINT__) 00020 #include <sys/time.h> 00021 #include <WINDOWS.H> 00022 #ifdef min 00023 #undef min 00024 #endif 00025 #ifdef max 00026 #undef max 00027 #endif 00028 #include <sql.h> 00029 #include <sqlext.h> 00030 #else 00031 typedef long SQLHENV; 00032 typedef long SQLHDBC; 00033 typedef long SQLHSTMT; 00034 #endif 00035 00036 00037 00038 class TSapDBServer : public TSQLServer { 00039 00040 private: 00041 SQLHDBC fSapDB; // connection to SapDB server 00042 SQLHENV fEnv; // environment for/of ODBC call 00043 SQLHSTMT fStmt; // statement result set 00044 SQLHSTMT fStmtCnt; // statement result set 00045 00046 static Int_t printSQLError(SQLHDBC hdbc, SQLHSTMT hstmt); 00047 00048 public: 00049 TSapDBServer(const char *db, const char *uid, const char *pw); 00050 ~TSapDBServer(); 00051 00052 void Close(Option_t *opt=""); 00053 TSQLResult *Query(const char *sql); 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 TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0); 00058 Int_t CreateDataBase(const char *dbname); 00059 Int_t DropDataBase(const char *dbname); 00060 Int_t Reload(); 00061 Int_t Shutdown(); 00062 const char *ServerInfo(); 00063 00064 ClassDef(TSapDBServer,0) // Connection to SapDB server 00065 }; 00066 00067 #endif