#ifndef ROOT_TSQLServer
#define ROOT_TSQLServer
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
class TSQLResult;
class TSQLStatement;
class TSQLTableInfo;
class TList;
class TSQLServer : public TObject {
protected:
TString fType;
TString fHost;
TString fDB;
Int_t fPort;
Int_t fErrorCode;
TString fErrorMsg;
Bool_t fErrorOut;
TSQLServer()
: fType(), fHost(), fDB(), fPort(-1), fErrorCode(0),
fErrorMsg(), fErrorOut(kTRUE) { ClearError(); }
void ClearError();
void SetError(Int_t code, const char* msg, const char* method = 0);
public:
enum ESQLDataTypes {
kSQL_NONE = -1,
kSQL_CHAR = 1,
kSQL_VARCHAR = 2,
kSQL_INTEGER = 3,
kSQL_FLOAT = 4,
kSQL_DOUBLE = 5,
kSQL_NUMERIC = 6,
kSQL_BINARY = 7,
kSQL_TIMESTAMP = 8
};
virtual ~TSQLServer() { }
virtual void Close(Option_t *option="") = 0;
virtual TSQLResult *Query(const char *sql) = 0;
virtual Bool_t Exec(const char* sql);
virtual TSQLStatement *Statement(const char*, Int_t = 100)
{ AbstractMethod("Statement"); return 0; }
virtual Bool_t HasStatement() const { return kFALSE; }
virtual Int_t SelectDataBase(const char *dbname) = 0;
virtual TSQLResult *GetDataBases(const char *wild = 0) = 0;
virtual TSQLResult *GetTables(const char *dbname, const char *wild = 0) = 0;
virtual TList *GetTablesList(const char* wild = 0);
virtual Bool_t HasTable(const char* tablename);
virtual TSQLTableInfo *GetTableInfo(const char* tablename);
virtual TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0) = 0;
virtual Int_t GetMaxIdentifierLength() { return 20; }
virtual Int_t CreateDataBase(const char *dbname) = 0;
virtual Int_t DropDataBase(const char *dbname) = 0;
virtual Int_t Reload() = 0;
virtual Int_t Shutdown() = 0;
virtual const char *ServerInfo() = 0;
virtual Bool_t IsConnected() const { return fPort == -1 ? kFALSE : kTRUE; }
const char *GetDBMS() const { return fType.Data(); }
const char *GetDB() const { return fDB.Data(); }
const char *GetHost() const { return fHost.Data(); }
Int_t GetPort() const { return fPort; }
virtual Bool_t IsError() const { return GetErrorCode()!=0; }
virtual Int_t GetErrorCode() const;
virtual const char* GetErrorMsg() const;
virtual void EnableErrorOutput(Bool_t on = kTRUE) { fErrorOut = on; }
virtual Bool_t StartTransaction();
virtual Bool_t Commit();
virtual Bool_t Rollback();
static TSQLServer *Connect(const char *db, const char *uid, const char *pw);
ClassDef(TSQLServer,0)
};
#endif
Last change: Wed Jun 25 08:52:39 2008
Last generated: 2008-06-25 08:52
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.