library: libSQL
#include "TSQLFile.h"

TSQLFile


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

class TSQLFile : public TFile

Inheritance Chart:
TObject
<-
TNamed
<-
TDirectory
<-
TFile
<-
TSQLFile
    private:
void operator=(const TSQLFile&) protected:
TString CodeLongString(Long64_t objid, Int_t strid) void CreateBasicTables() Long64_t DefineNextKeyId() void DeleteKeyFromDB(Long64_t keyid) TSQLClassInfo* FindSQLClassInfo(const char* clname, Int_t version) TKeySQL* FindSQLKey(TDirectory* dir, Long64_t keyid) TSQLResult* GetBlobClassData(Long64_t objid, TSQLClassInfo* sqlinfo) Int_t GetLocking() Bool_t GetLongString(Long64_t objid, Int_t strid, TString& value) TSQLResult* GetNormalClassData(Long64_t objid, TSQLClassInfo* sqlinfo) TSQLResult* GetNormalClassDataAll(Long64_t minobjid, Long64_t maxobjid, TSQLClassInfo* sqlinfo) TSQLObjectData* GetObjectClassData(Long64_t objid, TSQLClassInfo* sqlinfo) void IncrementModifyCounter() void InitSqlDatabase(Bool_t create) Int_t IsLongStringCode(Long64_t objid, const char* value) Bool_t IsReadAccess() Bool_t IsTablesExists() Bool_t IsWriteAccess() Bool_t ProduceClassSelectQuery(TStreamerInfo* info, TSQLClassInfo* sqlinfo, TString& columns, TString& tables, Int_t& tablecnt) Bool_t ReadConfigurations() TObject* ReadSpecialObject(Long64_t keyid, TObject* obj = 0) TSQLClassInfo* RequestSQLClassInfo(const char* clname, Int_t version, Bool_t force = kFALSE) TSQLClassInfo* RequestSQLClassInfo(const TClass* cl, Bool_t force = kFALSE) void SaveToDatabase() void SetLocking(Int_t mode) Bool_t SQLApplyCommands(TObjArray* cmds) const char* SQLBigTextType() const Bool_t SQLCommit() const char* SQLCompatibleType(Int_t typ) const const char* SQLDatetimeType() const const char* SQLDefaultTableType() const void SQLDeleteAllTables() const char* SQLDirIdColumn() const const char* SQLIdentifierQuote() const const char* SQLIntType() const const char* SQLKeyIdColumn() const Long64_t SQLMaximumValue(const char* tablename, const char* columnname) const char* SQLNameSeparator() const const char* SQLObjectIdColumn() const Bool_t SQLObjectInfo(Long64_t objid, TString& clname, Version_t& version) TObjArray* SQLObjectsInfo(Long64_t keyid) TSQLResult* SQLQuery(const char* cmd, Int_t flag = 0, Bool_t* res = 0) const char* SQLRawIdColumn() const Bool_t SQLRollback() const char* SQLSmallTextType() const Int_t SQLSmallTextTypeLimit() const Bool_t SQLStartTransaction() const char* SQLStrIdColumn() const TObjArray* SQLTableColumns(const char* tablename) TObjArray* SQLTablesList(const char* searchtable = "0") Bool_t SQLTestTable(const char* tablename) const char* SQLValueQuote() const Long64_t StoreObjectInTables(Long64_t keyid, const void* obj, const TClass* cl) Int_t StreamKeysForDirectory(TDirectory* dir, Bool_t doupdate, Long64_t specialkeyid = -1, TKeySQL** specialkey = 0) Bool_t SyncSQLClassInfo(TSQLClassInfo* sqlinfo, TObjArray* columns, Bool_t hasrawdata) virtual Int_t SysClose(Int_t) virtual Int_t SysOpen(const char*, Int_t, UInt_t) virtual Int_t SysRead(Int_t, void*, Int_t) virtual Long64_t SysSeek(Int_t, Long64_t, Int_t) virtual Int_t SysStat(Int_t, Long_t*, Long64_t*, Long_t*, Long_t*) virtual Int_t SysSync(Int_t) virtual Int_t SysWrite(Int_t, const void*, Int_t) Bool_t UpdateKeyData(TKeySQL* key) Bool_t VerifyLongStringTable() Long64_t VerifyObjectTable() Bool_t WriteKeyData(TKeySQL* key) Bool_t WriteSpecialObject(Long64_t keyid, TObject* obj, const char* name, const char* title) public:
TSQLFile() TSQLFile(const char* dbname, Option_t* option = "read", const char* user = "user", const char* pass = "pass") virtual ~TSQLFile() static TClass* Class() virtual void Close(Option_t* option = "") Bool_t Commit() virtual TKey* CreateKey(TDirectory* mother, const TObject* obj, const char* name, Int_t bufsize) virtual TKey* CreateKey(TDirectory* mother, const void* obj, const TClass* cl, const char* name, Int_t bufsize) virtual void DrawMap(const char* = "*", Option_t* = "") virtual void FillBuffer(char*&) virtual void Flush() Int_t GetArrayLimit() const const char* GetDataBaseName() const virtual Long64_t GetEND() const virtual Int_t GetErrno() const virtual Int_t GetNbytesFree() const virtual Int_t GetNbytesInfo() const virtual Int_t GetNfree() const Int_t GetQuerisCounter() const virtual Long64_t GetSeekFree() const virtual Long64_t GetSeekInfo() const virtual Long64_t GetSize() const virtual TList* GetStreamerInfoList() const char* GetTablesType() const Int_t GetUseIndexes() const Bool_t GetUseSuffixes() const Int_t GetUseTransactions() const virtual TClass* IsA() const Bool_t IsMySQL() const virtual Bool_t IsOpen() const Bool_t IsOracle() const virtual void MakeFree(Long64_t, Long64_t) virtual void MakeProject(const char*, const char* = "*", Option_t* = "new") TString MakeSelectQuery(TClass* cl) virtual void Map() virtual void Paint(Option_t* = "") virtual void Print(Option_t* = "") const virtual Bool_t ReadBuffer(char*, Int_t) virtual void ReadFree() virtual Int_t Recover() virtual Int_t ReOpen(Option_t* mode) virtual void ResetErrno() const Bool_t Rollback() virtual void Seek(Long64_t, TFile::ERelativeTo = kBeg) void SetArrayLimit(Int_t limit = 20) virtual void SetEND(Long64_t) void SetTablesType(const char* table_type) void SetUseIndexes(Int_t use_type = kIndexesBasic) void SetUseSuffixes(Bool_t on = kTRUE) void SetUseTransactions(Int_t mode = kTransactionsAuto) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual Int_t Sizeof() const void SkipArrayLimit() void StartLogFile(const char* fname) Bool_t StartTransaction() void StopLogFile() virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void UseCache(Int_t = 10, Int_t = TCache::kDfltPageSize) virtual Int_t Write(const char* = "0", Int_t = 0, Int_t = 0) virtual Int_t Write(const char* = "0", Int_t = 0, Int_t = 0) const virtual Bool_t WriteBuffer(const char*, Int_t) virtual void WriteFree() virtual void WriteHeader() virtual void WriteStreamerInfo()

Data Members


    protected:
TSQLServer* fSQL ! interface to SQL database TList* fSQLClassInfos ! list of SQL class infos Bool_t fUseSuffixes ! use suffixes in column names like fValue:Int_t or fObject:pointer Int_t fSQLIOversion ! version of SQL I/O which is stored in configurations Int_t fArrayLimit ! limit for array size. when array bigger, its content converted to raw format Bool_t fCanChangeConfig ! variable indicates can be basic configuration changed or not TString fTablesType ! type, used in CREATE TABLE statements Int_t fUseTransactions ! use transaction statements for writing data into the tables Int_t fUseIndexes ! use indexes for tables: 0 - off, 1 - only for basic tables, 2 + normal class tables, 3 - all tables Int_t fModifyCounter ! indicates how many changes was done with database tables Int_t fQuerisCounter ! how many query was applied const char** fBasicTypes ! pointer on list of basic types specific for currently connected SQL server const char** fOtherTypes ! pointer on list of other SQL types like TEXT or blob TString fUserName ! user name, used to access objects from database ofstream* fLogFile ! log file with SQL statements public:
static const TSQLFile::ELockingKinds kLockFree static const TSQLFile::ELockingKinds kLockBusy static const TSQLFile::ETransactionKinds kTransactionsOff static const TSQLFile::ETransactionKinds kTransactionsAuto static const TSQLFile::ETransactionKinds kTransactionsUser static const TSQLFile::EIndexesKinds kIndexesNone static const TSQLFile::EIndexesKinds kIndexesBasic static const TSQLFile::EIndexesKinds kIndexesClass static const TSQLFile::EIndexesKinds kIndexesAll

Class Description

 The main motivation for the TSQLFile development is to have
 "transparent" access to SQL data base via standard TFile interface.

 The main approach that each class (but not each object) has one or two tables
 with names like $(CLASSNAME)_ver$(VERSION) and $(CLASSNAME)_streamer_ver$(VERSION)
 For example: TAxis_ver8 or TList_streamer_ver5
 Second kind of tables appears, when some of class members can not be converted to
 normalized form or when class has custom streamer.
 For instance, for TH1 class two tables are required: TH1_ver4 and TH1_streamer_ver4
 Most of memebers are stored in TH1_ver4 table columnwise, and only memeber:

  Double_t*  fBuffer;  //[fBufferSize]

 can not be represented as column while size of array is not known apriory.
 Therefore, fBuffer will be written as list of values in TH1_streamer_ver4 table.

 All objects, stored in the DB, will be registered in table "ObjectsTable".
 In this there are following columns:
     "key:id"  - key identifier to which belong object
     "obj:id"  - object identifier
     "Class"   - object class name
     "Version" - object class version
  Data in each "ObjectsTable" row uniqly identify, in which table
  and which column object is stored.

 In normal situation all class data should be sorted columnwise.
 Up to now following member are supported:
 1) Basic data types
     Here is everything clear. Column SQL type will be as much as possible
     close to the original type of value.
 2) Fixed array of basic data types
     In this case n columns like fArr[0], fArr[1] and so on will be created.
     If there is multidimensional array, names will be fArr2[1][2][1] and so on
 3) Parent class
     In this case version of parent class is stored and
     data of parent class will be stored with the same obj:id in corrspondent table.
     There is a special case, when parent store nothing (this is for instance TQObject).
     In that case just -1 is written to avoid any extra checks if table exist or not.
 4) Object as data member.
     In that case object is saved in normal way to data base and column
     will contain id of this object.
 5) Pointer on object
     Same as before. In case if object was already stored, just its id
     will be placed in the column. For NULL pointer 0 is used.
 6) TString
     Now column with limited width like VARCAHR(255) in MySQL is used.
     Later this will be improved to support maximum possible strings
 7) Anything else.
     Data will be converted to raw format and saved in _streamer_ table.
     Each row supplied with obj:id and row:id, where row:id indicates
     data, corresponding to this particular data member, and column
     will contain this raw:id

 All conversion to SQL statements are done with help of TSQLStructure class.
 This is special hierarchical structure wich internally is very similar
 to XML structures. TBufferSQL2 creates these structures, when object
 data is streamed by ROOT and only afterwards all SQL statements will be produced
 and applied all together.

 When data is reading, TBufferSQL2 will produce requests to database
 during unstreaming of object data.

 Optionally (default this options on) name of column includes
 suffix which indicates type of column. For instance:
   *:parent  - parent class, column contain class version
   *:object  - other object, column contain object id
   *:rawdata - raw data, column contains id of raw data from _streamer_ table
   *:Int_t   - column with integer value
 Use TSQLFile::SetUseSuffixes(kFALSE) to disable suffixes usage.

 This and several other options can be changed only when
 TSQLFile created with options "CREATE" or "RECREATE" and only before
 first write operation. These options are:
     SetUseSuffixes() - suffix usage in column names (default - on)
     SetArrayLimit()  - defines maximum array size, which can
                        has column for each element (default 20)
     SetTablesType()  - table type name in MySQL database (default "InnoDB")
     SetUseIndexes()  - usage of indexes in database (default kIndexesBasic)
 Normally these functions should be called immidiately after TSQLFile constructor.

 When objects data written to database, by default START TRANSACTION/COMMIT
 SQL commands are used before and after data storage. If TSQLFile detects
 any problems, ROLLBACK command will be used to restore
 previous state of data base. If transactions not supported by SQL server,
 they can be disabled by SetUseTransactions(kTransactionsOff). Or user
 can take responsibility to use transactions function to hime

 By default only indexes for basic tables are created.
 In most cases usage of indexes increase perfomance to data reading,
 but it also can increase time of writing data to database.
 There are several modes of index usage available in SetUseIndexes() method

 There is MakeSelectQuery(TClass*) method, which
 produces SELECT statement to get objects data of specified class.
 Difference from simple statement like:
   mysql> SELECT * FROM TH1I_ver1
 that not only data for that class, but also data from parent classes
 will be extracted from other tables and combined in single result table.
 Such select query can be usufull for external access to objects data.

 Up to now MySQL 4.1 and Oracle 9i were tested.
 Some extra work is required for other SQL databases.
 Hopefully, this should be straigthforward.

 Known problems and open questions.
 1) TTree is not supported by TSQLFile. There is independent development
    of TTreeSQL class, which allows to store trees directly in SQL database
 2) TClonesArray is store objects in raw format,
    which can not be accessed outside ROOT.
    This will be changed later.
 3) TDirectory cannot work. Hopefully, will (changes in ROOT basic I/O is required)
 4) Streamer infos are not written to file, therefore schema evolution
    is not yet supported. All eforts are done to enable this feature in
    the near future

 Example how TSQLFile can be used:

 example of a session saving data to a SQL data base
 =====================================================

  const char* dbname = "mysql://host.domain:3306/dbname";
  const char* username = "username";
  const char* userpass = "userpass";

  // Clean data base and create primary tables
  TSQLFile* f = new TSQLFile(dbname, "recreate", username, userpass);
  // Write with standard I/O functions
  arr->Write("arr", TObject::kSingleKey);
  h1->Write("histo");
  // Close connection to DB
  delete f;

 example of a session read data from SQL data base
 =====================================================

  // Open database again in read-only mode
  TSQLFile* f = new TSQLFile(dbname, "open", username, userpass);
  // Show list of keys
  f->ls();
  // Read stored object, again standard ROOT I/O
  TH1* h1 = (TH1*) f->Get("histo");
  if (h1!=0) { h1->SetDirectory(0); h1->Draw(); }
  TObject* obj = f->Get("arr");
  if (obj!=0) obj->Print("*");
  // close connection to DB
  delete f;

 The "SQL I/O" package is currently under development.
 Any bug reports and suggestions are welcome.
 Author: S.Linev, GSI Darmstadt,   S.Linev@gsi.de

______________________________________________________________________________

TSQLFile() : TFile(), fSQL(0), fSQLClassInfos(0), fUseSuffixes(kTRUE), fSQLIOversion(1), fArrayLimit(20), fCanChangeConfig(kFALSE), fTablesType(), fUseTransactions(0), fUseIndexes(0), fModifyCounter(0), fQuerisCounter(0), fBasicTypes(0), fOtherTypes(0), fUserName(), fLogFile(0)
 default TSQLFile constructor

TSQLFile(const char* dbname, Option_t* option, const char* user, const char* pass) : TFile(), fSQL(0), fSQLClassInfos(0), fUseSuffixes(kTRUE), fSQLIOversion(1), fArrayLimit(20), fCanChangeConfig(kFALSE), fTablesType(), fUseTransactions(0), fUseIndexes(0), fModifyCounter(0), fQuerisCounter(0), fBasicTypes(mysql_BasicTypes), fOtherTypes(mysql_OtherTypes), fUserName(user), fLogFile(0)
 Connects to SQL server with provided arguments.
 If the constructor fails in any way IsZombie() will
 return true. Use IsOpen() to check if the file is (still) open.

 If option = NEW or CREATE   create a ROOT tables in database
                             if the tables already exists connection is
                             not opened.
           = RECREATE        create completely new tables. Any existing tables
                             will be deleted
           = UPDATE          open an existing database for writing.
                             If data base open by other TSQLFile instance for writing,
                             write access will be rejected
           = BREAKLOCK       Special case when lock was not correctly released
                             by TSQLFile instance. This may happen if program crashed when
                             TSQLFile was open with write access mode.
           = READ or OPEN    open an existing data base for reading.

 For more details see comments for TFile::TFile() constructor

 For a moment TSQLFile does not support TTree objects and subdirectories

void StartLogFile(const char* fname)
 start logging of all SQL statements in specified file

void StopLogFile()
 close logging file

Bool_t IsMySQL() const
 checks, if MySQL database

Bool_t IsOracle() const
 checks, if Oracle database

void SetUseSuffixes(Bool_t on)
 enable/disable uasge of suffixes in columns names
 can be changed before first object is saved into file

void SetArrayLimit(Int_t limit)
 Defines maximum number of columns for array representation
 If array size bigger than limit, array data will be converted to raw format
 This is usefull to prevent tables with very big number of columns
 If limit==0, all arrays will be stored in raw format
 If limit<0, all array values will be stored in column form
 Default value is 20

void SetTablesType(const char* tables_type)
 Defines tables type, which is used in CREATE TABLE statements
 Now is only used for MySQL database, where following types are supported:
    "BDB", "HEAP", "ISAM", "InnoDB", "MERGE", "MRG_MYISAM", "MYISAM"
 Default for TSQLFile is "InnoDB". For more detailes see MySQL docs.

void SetUseTransactions(Int_t mode)
 Defines usage of transactions statements for writing objects data to database.
    kTransactionsOff=0   - no transaction operation are allowed
    kTransactionsAuto=1  - automatic mode. Each write operation,
        produced by TSQLFile, will be supplied by START TRANSACTION and COMMIT calls.
        If any error happen, ROLLBACK will returns database to previous state
    kTransactionsUser=2  - transactions are delegated to user. Methods
        StartTransaction(), Commit() and Rollback() should be called by user.
 Default UseTransactions option is kTransactionsAuto

Bool_t StartTransaction()
 Start user transaction.
 This can be usesfull, when big number of objects should be stored in
 data base and commitment required only if all operations were succesfull.
 In that case in the end of all operations method Commit() should be
 called. If operation on user-level is looks like not successfull,
 method Rollback() will return database data and TSQLFile instance to
 previous state.
 In MySQL not all tables types support transaction mode of operation.
 See SetTablesType() method for details .

Bool_t Commit()
 Commit transaction, started by StartTransaction() call.
 Only after that call data will be written and visible on database side.

Bool_t Rollback()
 Rollback all operations, done after StartTransaction() call.
 Database should return to initial state.

void SetUseIndexes(Int_t use_type)
 Specify usage of indexes for data tables
    kIndexesNone = 0  - no indexes are used
    kIndexesBasic = 1 - indexes used only for keys list and
                        objects list tables (default)
    kIndexesClass = 2 - index also created for every normal class table
    kIndexesAll = 3   - index created for every table, including _streamer_ tables
 Indexes in general should increase speed of access to objects data,
 but they required more operations and more disk space on server side

const char* GetDataBaseName() const
 Return name of data base on the host
 For Oracle always return 0

void Close(Option_t *option)
 Close a SQL file
 For more comments see TFile::Close() function

~TSQLFile()
 destructor of TSQLFile object

Bool_t IsOpen() const
 return kTRUE if file is opened and can be accessed

Int_t ReOpen(Option_t* mode)
 Reopen a file with a different access mode, like from READ to
 See TFile::Open() for details

TKey* CreateKey(TDirectory* mother, const TObject* obj, const char* name, Int_t )
 create SQL key, which will store object in data base

TKey* CreateKey(TDirectory* mother, const void* obj, const TClass* cl, const char* name, Int_t )
 create SQL key, which will store object in data base

void WriteHeader()
 Write file info like configurations, title, UUID and other

void WriteStreamerInfo()
 Store all TStreamerInfo, used in file, in sql database
 For the moment function is disabled while no proper reader is
 existing

Bool_t WriteSpecialObject(Long64_t keyid, TObject* obj, const char* name, const char* title)
 write special kind of object like streamer infos or file itself
 keys for that objects should exist in tables but not indicated in list of keys,
 therefore users can not get them with TDirectory::Get() method

TObject* ReadSpecialObject(Long64_t keyid, TObject* obj)
 Read data of special kind of objects

TList* GetStreamerInfoList()
 Read back streamer infos from database
 List of streamer infos is always stored with key:id 0,
 which is not shown in normal keys list
 Method is not active while TStreamerElement and TStreamerBase has custom
 streamers, which can not be handled by TBufferSQL2.
 Hopefully, problem will be solved soon

void SaveToDatabase()
 save data which is not yet in Database
 Typically this is streamerinfos structures or

Int_t StreamKeysForDirectory(TDirectory* dir, Bool_t doupdate, Long64_t specialkeyid, TKeySQL** specialkey)
 read keys for specified directory (when update == kFALSE)
 or update value for modified keys when update == kTRUE
 Returns number of succesfully read keys or -1 if error

void InitSqlDatabase(Bool_t create)
 initialize sql database and correspondent structures
 identical to TFile::Init() function

Bool_t ReadConfigurations()
 read table configurations as special table

void CreateBasicTables()
 Creates initial tables in database
 This is table with configurations and table with keys
 Function called once when first object is stored to the file.

void IncrementModifyCounter()

TString MakeSelectQuery(TClass* cl)
 Produce SELECT statement which can be used to get all data
 of class cl in one SELECT statement
 This statement also can be used to create VIEW by command like
 mysql> CREATE VIEW TH1I_view AS $CLASSSELECT$
 Where $CLASSSELECT$ argument should be produced by call
   f->MakeSelectQuery(TH1I::Class());
 VIEWs supported by latest MySQL 5 and Oracle

Bool_t ProduceClassSelectQuery(TStreamerInfo* info, TSQLClassInfo* sqlinfo, TString& columns, TString& tables, Int_t& tablecnt)
 used by MakeClassSelectQuery method to add columns from table of
 class, specified by TStreamerInfo structure

Bool_t IsTablesExists()
 Checks if main keys table is existing

Bool_t IsWriteAccess()
 Checkis, if lock is free in configuration tables

void SetLocking(Int_t mode)
 Set locking mode for current database

Int_t GetLocking()
 Return current locking mode for that file

Bool_t IsReadAccess()
 dummy, in future should check about read access to database

TSQLResult* SQLQuery(const char* cmd, Int_t flag, Bool_t* ok)
 submits query to SQL server
 if flag==0, result is not interesting and will be deleted
 if flag==1, return result of submitted query
 if flag==2, results is may be necessary for long time
             Oracle plugin do not support working with several TSQLResult
             objects, therefore explicit deep copy will be produced
 If ok!=0, it will contains kTRUE is Query was successfull, otherwise kFALSE

Bool_t SQLApplyCommands(TObjArray* cmds)
 supplies set of commands to server
 Commands is stored as array of TObjString

TObjArray* SQLTablesList(const char* searchtable)
 Produces list of tables, presented in database
 if searchtable!=0, looks only for this specific table
 list should be deleted by user afterwards
 P.S. Unfortunately, the TSQLServer::GetTables function is not
 correctly implemented for all cases,
 therefore special function is required.

TObjArray* SQLTableColumns(const char* tablename)
 produces list of columns for specified table
 list consist of TNamed objects with name and type for each column
 list should be deleted aftrewards
 P.S. Oracle plug-in do not provides types

Bool_t SQLTestTable(const char* tablename)
 Test, if table of specified name exists

Long64_t SQLMaximumValue(const char* tablename, const char* columnname)
 Returns maximum value, found in specified columnname of table tablename
 Column type should be numeric

void SQLDeleteAllTables()
 Delete all tables in database

Bool_t SQLStartTransaction()
 Start SQL transaction.

Bool_t SQLCommit()
 Commit SQL transaction

Bool_t SQLRollback()
 Rollback all SQL operations, done after start transaction

void DeleteKeyFromDB(Long64_t keyid)
 remove key with specified id from keys table
 also removes all objects data, related to this table

TKeySQL* FindSQLKey(TDirectory* dir, Long64_t keyid)
 Search for TKeySQL object with specified keyid

Bool_t WriteKeyData(TKeySQL* key)
 add entry into keys table

Bool_t UpdateKeyData(TKeySQL* key)

Long64_t DefineNextKeyId()
 Returns next possible key identifier

TSQLClassInfo* FindSQLClassInfo(const char* clname, Int_t version)
 return (if exists) TSQLClassInfo for specified class and version

TSQLClassInfo* RequestSQLClassInfo(const char* clname, Int_t version, Bool_t force)
 search in database tables for specified class and return TSQLClassInfo object

TSQLClassInfo* RequestSQLClassInfo(const TClass* cl, Bool_t force)
 search in database tables for specified class and return TSQLClassInfo object

Bool_t SyncSQLClassInfo(TSQLClassInfo* sqlinfo, TObjArray* columns, Bool_t hasrawdata)
 Synchronise TSQLClassInfo structure with specified columns list and
 create/delete appropriate tables in database

Bool_t VerifyLongStringTable()
 Checks that table for big strings is exists
 If not, will be created

TString CodeLongString(Long64_t objid, Int_t strid)
 produces id which will be placed in column instead of string itself

Int_t IsLongStringCode(Long64_t objid, const char* value)
 checks if this is long string code
 returns 0, if not or string id

Bool_t GetLongString(Long64_t objid, Int_t strid, TString& value)
 returns value of string, extracted from special table,
 where long strings are stored

Long64_t VerifyObjectTable()
 Checks that objects table is exists
 If not, table will be created
 Returns maximum value for existing objects id

Bool_t SQLObjectInfo(Long64_t objid, TString& clname, Version_t &version)
 Read from objects table data for specified objectid

TObjArray* SQLObjectsInfo(Long64_t keyid)
 Produce array of TSQLObjectInfo objects for all objects, belong to that key
 Array should be deleted by calling function afterwards

TSQLResult* GetNormalClassData(Long64_t objid, TSQLClassInfo* sqlinfo)
 Method return request result for specified objid from normal classtable

TSQLResult* GetNormalClassDataAll(Long64_t minobjid, Long64_t maxobjid, TSQLClassInfo* sqlinfo)

TSQLResult* GetBlobClassData(Long64_t objid, TSQLClassInfo* sqlinfo)
  Method return request results for specified objid from _streamer_ classtable

TSQLObjectData* GetObjectClassData(Long64_t objid, TSQLClassInfo* sqlinfo)
 Get data for specified object from particular class table
 Returns TSQLObjectData object, which contains one row from
 normal class table and data from _streamer_ table.
 TSQLObjectData object used later in TBufferSQL2 to unstream object

Long64_t StoreObjectInTables(Long64_t keyid, const void* obj, const TClass* cl)
 Store object in database. Return stored object id or -1 if error

const char* SQLCompatibleType(Int_t typ) const
 returns sql type name which is most closer to ROOT basic type
 typ should be from TStreamerInfo::constansts like TStreamerInfo::kInt

const char* SQLIntType() const
 return SQL integer type



Inline Functions


              Int_t SysOpen(const char*, Int_t, UInt_t)
              Int_t SysClose(Int_t)
              Int_t SysRead(Int_t, void*, Int_t)
              Int_t SysWrite(Int_t, const void*, Int_t)
           Long64_t SysSeek(Int_t, Long64_t, Int_t)
              Int_t SysStat(Int_t, Long_t*, Long64_t*, Long_t*, Long_t*)
              Int_t SysSync(Int_t)
        const char* SQLSmallTextType() const
              Int_t SQLSmallTextTypeLimit() const
        const char* SQLBigTextType() const
        const char* SQLDatetimeType() const
        const char* SQLIdentifierQuote() const
        const char* SQLDirIdColumn() const
        const char* SQLKeyIdColumn() const
        const char* SQLObjectIdColumn() const
        const char* SQLRawIdColumn() const
        const char* SQLStrIdColumn() const
        const char* SQLNameSeparator() const
        const char* SQLValueQuote() const
        const char* SQLDefaultTableType() const
               void operator=(const TSQLFile&)
             Bool_t GetUseSuffixes() const
              Int_t GetArrayLimit() const
               void SkipArrayLimit()
        const char* GetTablesType() const
              Int_t GetUseTransactions() const
              Int_t GetUseIndexes() const
              Int_t GetQuerisCounter() const
               void DrawMap(const char* = "*", Option_t* = "")
               void FillBuffer(char*&)
               void Flush()
           Long64_t GetEND() const
              Int_t GetErrno() const
               void ResetErrno() const
              Int_t GetNfree() const
              Int_t GetNbytesInfo() const
              Int_t GetNbytesFree() const
           Long64_t GetSeekFree() const
           Long64_t GetSeekInfo() const
           Long64_t GetSize() const
               void MakeFree(Long64_t, Long64_t)
               void MakeProject(const char*, const char* = "*", Option_t* = "new")
               void Map()
               void Paint(Option_t* = "")
               void Print(Option_t* = "") const
             Bool_t ReadBuffer(char*, Int_t)
               void ReadFree()
              Int_t Recover()
               void Seek(Long64_t, TFile::ERelativeTo = kBeg)
               void SetEND(Long64_t)
              Int_t Sizeof() const
               void UseCache(Int_t = 10, Int_t = TCache::kDfltPageSize)
             Bool_t WriteBuffer(const char*, Int_t)
              Int_t Write(const char* = "0", Int_t = 0, Int_t = 0)
              Int_t Write(const char* = "0", Int_t = 0, Int_t = 0) const
               void WriteFree()
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)


Author: Sergey Linev 20/11/2005
Last update: root/sql:$Name: $:$Id: TSQLFile.cxx,v 1.7 2006/02/01 18:57:41 pcanal Exp $
Copyright (C) 1995-2005, 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.