class TSQLServer: public TObject


TSQLServer

Abstract base class defining interface to a SQL server.

To open a connection to a server use the static method Connect().
The db argument of Connect() is of the form:
<dbms>://<host>[:<port>][/<database>], e.g.
mysql://pcroot.cern.ch:3456/test, oracle://srv1.cern.ch/main, ...
Depending on the <dbms> specified an appropriate plugin library
will be loaded which will provide the real interface.

Related classes are TSQLResult and TSQLRow.


Function Members (Methods)

 
    This is an abstract class, constructors will not be documented.
    Look at the header to check for available constructors.

public:
virtual~TSQLServer()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual voidClose(Option_t* option = "")
virtual Bool_tCommit()
virtual Int_tTObject::Compare(const TObject* obj) const
static TSQLServer*Connect(const char* db, const char* uid, const char* pw)
virtual voidTObject::Copy(TObject& object) const
virtual Int_tCreateDataBase(const char* dbname)
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual Int_tDropDataBase(const char* dbname)
virtual voidTObject::Dump() constMENU
virtual voidEnableErrorOutput(Bool_t on = kTRUE)
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual Bool_tExec(const char* sql)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual TSQLResult*GetColumns(const char* dbname, const char* table, const char* wild = 0)
virtual TSQLResult*GetDataBases(const char* wild = 0)
const char*GetDB() const
const char*GetDBMS() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Int_tGetErrorCode() const
virtual const char*GetErrorMsg() const
const char*GetHost() const
virtual const char*TObject::GetIconName() const
virtual Int_tGetMaxIdentifierLength()
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Int_tGetPort() const
virtual TSQLTableInfo*GetTableInfo(const char* tablename)
virtual TSQLResult*GetTables(const char* dbname, const char* wild = 0)
virtual TList*GetTablesList(const char* wild = 0)
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual Bool_tHasStatement() const
virtual Bool_tHasTable(const char* tablename)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tIsConnected() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsError() const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TSQLServer&operator=(const TSQLServer&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual TSQLResult*Query(const char* sql)
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
virtual Int_tReload()
voidTObject::ResetBit(UInt_t f)
virtual Bool_tRollback()
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
virtual Int_tSelectDataBase(const char* dbname)
virtual const char*ServerInfo()
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tShutdown()
virtual Bool_tStartTransaction()
virtual TSQLStatement*Statement(const char*, Int_t = 100)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
voidClearError()
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
voidSetError(Int_t code, const char* msg, const char* method = 0)

Data Members

public:
enum ESQLDataTypes { kSQL_NONE
kSQL_CHAR
kSQL_VARCHAR
kSQL_INTEGER
kSQL_FLOAT
kSQL_DOUBLE
kSQL_NUMERIC
kSQL_BINARY
kSQL_TIMESTAMP
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TStringfDBcurrently selected DB
Int_tfErrorCodeerror code of last operation
TStringfErrorMsgerror message of last operation
Bool_tfErrorOutenable error output
TStringfHosthost to which we are connected
Int_tfPortport to which we are connected
TStringfTypetype of DBMS (MySQL, Oracle, SysBase, ...)

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TSQLServer * Connect(const char* db, const char* uid, const char* pw)
 The db should be of the form:  <dbms>://<host>[:<port>][/<database>],
 e.g.:  mysql://pcroot.cern.ch:3456/test, oracle://srv1.cern.ch/main,
 pgsql://... or sapdb://...
 The uid is the username and pw the password that should be used for
 the connection. Depending on the <dbms> the shared library (plugin)
 for the selected system will be loaded. When the connection could not
 be opened 0 is returned.
Bool_t Exec(const char* sql)
 Execute sql query.
 Usefull for commands like DROP TABLE or INSERT, where result set
 is not interested. Return kTRUE if no error
Int_t GetErrorCode()
 returns error code of last operation
 if res==0, no error
 Each specific implementation of TSQLServer provides its own error coding
const char* GetErrorMsg()
 returns error message of last operation
 if no errors, return 0
 Each specific implementation of TSQLServer provides its own error messages
void ClearError()
 reset error fields
void SetError(Int_t code, const char* msg, const char* method = 0)
 set new values for error fields
 if method is specified, displays error message
Bool_t StartTransaction()
 submit "START TRANSACTION" query to database
 return kTRUE, if succesfull
Bool_t Commit()
 submit "COMMIT" query to database
 return kTRUE, if succesfull
Bool_t Rollback()
 submit "ROLLBACK" query to database
 return kTRUE, if succesfull
TList* GetTablesList(const char* wild = 0)
 Return list of user tables
 Parameter wild specifies wildcard for table names.
 It either contains exact table name to verify that table is exists or
 wildcard with "%" (any number of symbols) and "_" (exactly one symbol).
 Example of vaild wildcards: "%", "%name","___user__".
 If wild=="", list of all available tables will be produced.
 List contain just tables names in the TObjString.
 List must be deleted by the user.
 Example code of method usage:

 TList* lst = serv->GetTablesList();
 TIter next(lst);
 TObject* obj;
 while (obj = next())
   cout << "Table: " << obj->GetName() << endl;
 delete lst;
Bool_t HasTable(const char* tablename)
 Tests if table of that name exists in database
 Return kTRUE, if table exists
TSQLTableInfo* GetTableInfo(const char* tablename)
 Producec TSQLTableInfo object, which contain info about
 table itself and each table column
 Object must be deleted by user.
virtual ~TSQLServer()
{ }
void Close(Option_t* option = "")
TSQLResult * Query(const char* sql)
Bool_t HasStatement()
{ return kFALSE; }
Int_t SelectDataBase(const char* dbname)
TSQLResult * GetDataBases(const char* wild = 0)
TSQLResult * GetTables(const char* dbname, const char* wild = 0)
TSQLResult * GetColumns(const char* dbname, const char* table, const char* wild = 0)
Int_t GetMaxIdentifierLength()
{ return 20; }
Int_t CreateDataBase(const char* dbname)
Int_t DropDataBase(const char* dbname)
Int_t Reload()
Int_t Shutdown()
const char * ServerInfo()
Bool_t IsConnected()
{ return fPort == -1 ? kFALSE : kTRUE; }
const char * GetDBMS()
{ return fType.Data(); }
const char * GetDB()
{ return fDB.Data(); }
const char * GetHost()
{ return fHost.Data(); }
Int_t GetPort()
{ return fPort; }
Bool_t IsError()
{ return GetErrorCode()!=0; }
void EnableErrorOutput(Bool_t on = kTRUE)
{ fErrorOut = on; }

Author: Fons Rademakers 25/11/99
Last change: root/net:$Id: TSQLServer.h 23091 2008-04-09 15:04:27Z rdm $
Last generated: 2008-06-25 08:52
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

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.