TODBCServer.h

Go to the documentation of this file.
00001 // @(#)root/odbc:$Id: TODBCServer.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Sergey Linev   6/02/2006
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2006, 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_TODBCServer
00013 #define ROOT_TODBCServer
00014 
00015 #ifndef ROOT_TSQLServer
00016 #include "TSQLServer.h"
00017 #endif
00018 
00019 #ifdef __CINT__
00020 typedef void * SQLHENV;
00021 typedef void * SQLHDBC;
00022 typedef short  SQLRETURN;
00023 #else
00024 #ifdef WIN32
00025 #include "windows.h"
00026 #endif
00027 #include <sql.h>
00028 #endif
00029 
00030 class TList;
00031 
00032 class TODBCServer : public TSQLServer {
00033 
00034 private:
00035    SQLHENV   fHenv;
00036    SQLHDBC   fHdbc;
00037    TString   fServerInfo;        // string with DBMS name and version like MySQL 4.1.11 or Oracle 10.01.0030
00038    TString   fUserId;
00039 
00040    Bool_t ExtractErrors(SQLRETURN retcode, const char* method);
00041 
00042    Bool_t EndTransaction(Bool_t commit);
00043 
00044    static TList* ListData(Bool_t isdrivers);
00045 
00046 public:
00047    TODBCServer(const char* db, const char *uid, const char *pw);
00048    virtual ~TODBCServer();
00049 
00050    static TList* GetDrivers();
00051    static void PrintDrivers();
00052    static TList* GetDataSources();
00053    static void PrintDataSources();
00054 
00055    void        Close(Option_t *opt="");
00056    TSQLResult *Query(const char *sql);
00057    Bool_t      Exec(const char* sql);
00058    TSQLStatement *Statement(const char *sql, Int_t = 100);
00059    Bool_t      HasStatement() const { return kTRUE; }
00060    Int_t       SelectDataBase(const char *dbname);
00061    TSQLResult *GetDataBases(const char *wild = 0);
00062    TSQLResult *GetTables(const char *dbname, const char *wild = 0);
00063    TList      *GetTablesList(const char* wild = 0);
00064    TSQLTableInfo* GetTableInfo(const char* tablename);
00065    TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
00066    Int_t       GetMaxIdentifierLength();
00067    Int_t       CreateDataBase(const char *dbname);
00068    Int_t       DropDataBase(const char *dbname);
00069    Int_t       Reload();
00070    Int_t       Shutdown();
00071    const char *ServerInfo();
00072 
00073    Bool_t      StartTransaction();
00074    Bool_t      Commit();
00075    Bool_t      Rollback();
00076 
00077    ClassDef(TODBCServer,0)  // Connection to MySQL server
00078 };
00079 
00080 #endif

Generated on Tue Jul 5 15:14:38 2011 for ROOT_528-00b_version by  doxygen 1.5.1