library: libCore
#include "TSQLServer.h"

TSQLServer


class description - header file - source file - inheritance tree (.pdf)

class TSQLServer : public TObject

Inheritance Chart:
TObject
<-
TSQLServer
<-
TMySQLServer
TODBCServer
TOracleServer
 
    This is an abstract class, constructors will not be documented.
    Look at the header to check for available constructors.


    protected:
void ClearError() void SetError(Int_t code, const char* msg, const char* method = "0") public:
virtual ~TSQLServer() static TClass* Class() virtual void Close(Option_t* option = "") virtual Bool_t Commit() static TSQLServer* Connect(const char* db, const char* uid, const char* pw) virtual Int_t CreateDataBase(const char* dbname) virtual Int_t DropDataBase(const char* dbname) virtual void EnableErrorOutput(Bool_t on = kTRUE) virtual Bool_t Exec(const char* sql) virtual TSQLResult* GetColumns(const char* dbname, const char* table, const char* wild = "0") virtual TSQLResult* GetDataBases(const char* wild = "0") const char* GetDBMS() const virtual Int_t GetErrorCode() const virtual const char* GetErrorMsg() const const char* GetHost() const virtual Int_t GetMaxIdentifierLength() Int_t GetPort() 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 Bool_t HasTable(const char* tablename) virtual TClass* IsA() const virtual Bool_t IsConnected() const virtual Bool_t IsError() const virtual Bool_t IsSupportStatement() const TSQLServer& operator=(const TSQLServer&) virtual TSQLResult* Query(const char* sql) virtual Int_t Reload() virtual Bool_t Rollback() virtual Int_t SelectDataBase(const char* dbname) virtual const char* ServerInfo() virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Int_t Shutdown() virtual Bool_t StartTransaction() virtual TSQLStatement* Statement(const char*, Int_t = 100) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
TString fType type of DBMS (MySQL, Oracle, SysBase, ...) TString fHost host to which we are connected TString fDB currently selected DB Int_t fPort port to which we are connected Int_t fErrorCode error code of last operation TString fErrorMsg error message of last operation Bool_t fErrorOut enable error output public:
static const TSQLServer::ESQLDataTypes kSQL_NONE static const TSQLServer::ESQLDataTypes kSQL_CHAR static const TSQLServer::ESQLDataTypes kSQL_VARCHAR static const TSQLServer::ESQLDataTypes kSQL_INTEGER static const TSQLServer::ESQLDataTypes kSQL_FLOAT static const TSQLServer::ESQLDataTypes kSQL_DOUBLE static const TSQLServer::ESQLDataTypes kSQL_NUMERIC static const TSQLServer::ESQLDataTypes kSQL_BINARY static const TSQLServer::ESQLDataTypes kSQL_TIMESTAMP

Class Description

                                                                      
 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.                          
                                                                      

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)
 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)
 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="")
Bool_t IsSupportStatement()
Int_t SelectDataBase(const char *dbname)
Int_t GetMaxIdentifierLength()
Int_t CreateDataBase(const char *dbname)
Int_t DropDataBase(const char *dbname)
Int_t Reload()
Int_t Shutdown()
Bool_t IsConnected()
Int_t GetPort()
Bool_t IsError()
void EnableErrorOutput(Bool_t on = kTRUE)

Author: Fons Rademakers 25/11/99
Last update: root/net:$Name: $:$Id: TSQLServer.cxx,v 1.14 2006/06/25 18:43:24 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - Top of the page

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.