Logo ROOT   6.10/09
Reference Guide
TSQLFile.h
Go to the documentation of this file.
1 // @(#)root/sql:$Id$
2 // Author: Sergey Linev 20/11/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TSQLFile
13 #define ROOT_TSQLFile
14 
15 #include "TFile.h"
16 #include <stdlib.h>
17 
18 class TList;
19 class TStreamerElement;
21 
22 class TSQLServer;
23 class TSQLStatement;
24 class TSQLResult;
25 class TSQLRow;
26 class TKeySQL;
27 class TBufferSQL2;
28 class TSQLClassInfo;
29 
30 class TSQLFile : public TFile {
31 
32  friend class TBufferSQL2;
33  friend class TKeySQL;
34  friend class TSQLStructure;
35  friend class TSQLTableData;
36  friend class TSqlRegistry;
37  friend class TSqlRawBuffer;
38  friend class TSqlCmdsBuffer;
39 
40 protected:
42  kLockFree = 0,
44  };
45 
46  // Interface to basic system I/O routines, suppressed
47  virtual Int_t SysOpen(const char*, Int_t, UInt_t) { return 0; }
48  virtual Int_t SysClose(Int_t) { return 0; }
49  virtual Int_t SysRead(Int_t, void*, Int_t) { return 0; }
50  virtual Int_t SysWrite(Int_t, const void*, Int_t) { return 0; }
51  virtual Long64_t SysSeek(Int_t, Long64_t, Int_t) { return 0; }
52  virtual Int_t SysStat(Int_t, Long_t*, Long64_t*, Long_t*, Long_t*) { return 0; }
53  virtual Int_t SysSync(Int_t) { return 0; }
54 
55  // Overwrite methods for directory I/O
57  virtual Int_t DirReadKeys(TDirectory*);
58  virtual void DirWriteKeys(TDirectory*);
59  virtual void DirWriteHeader(TDirectory*);
60 
61  // functions to manipulate basic tables (Configurations, Objects, Keys) in database
62  void SaveToDatabase();
65  void InitSqlDatabase(Bool_t create);
66  void CreateBasicTables();
68  void SetLocking(Int_t mode);
69  Int_t GetLocking();
70 
71  // function for read/write access infos
74 
75  // generic sql functions
76  TSQLResult* SQLQuery(const char* cmd, Int_t flag = 0, Bool_t* res = 0);
78  TSQLStatement* SQLStatement(const char* cmd, Int_t bufsize = 1000);
81  Bool_t SQLTestTable(const char* tablename);
82  Long64_t SQLMaximumValue(const char* tablename, const char* columnname);
83  void SQLDeleteAllTables();
85  Bool_t SQLCommit();
88 
89  // operation with keys structures in database
90  void DeleteKeyFromDB(Long64_t keyid);
93  TKeySQL* FindSQLKey(TDirectory* dir, Long64_t keyid);
95  Int_t StreamKeysForDirectory(TDirectory* dir, Bool_t doupdate, Long64_t specialkeyid = -1, TKeySQL** specialkey = 0);
96 
97  // handling SQL class info structures
98  TSQLClassInfo* FindSQLClassInfo(const char* clname, Int_t version);
100  TSQLClassInfo* RequestSQLClassInfo(const char* clname, Int_t version);
102  Bool_t CreateClassTable(TSQLClassInfo* sqlinfo, TObjArray* colinfos);
104 
105  Bool_t ProduceClassSelectQuery(TVirtualStreamerInfo* info, TSQLClassInfo* sqlinfo, TString& columns, TString& tables, Int_t& tablecnt);
106  void AddIdEntry(Long64_t tableid, Int_t subid, Int_t type,
107  const char* name, const char* sqlname, const char* info);
108  void ReadSQLClassInfos();
109  TString DefineTableName(const char* clname, Int_t version, Bool_t rawtable);
110  Bool_t HasTable(const char* name);
111 
112  // operations with long string table
113  TString CodeLongString(Long64_t objid, Int_t strid);
114  Int_t IsLongStringCode(Long64_t objid, const char* value);
116  Bool_t GetLongString(Long64_t objid, Int_t strid, TString& value);
117 
118  // operation with object tables in database
120  Bool_t SQLObjectInfo(Long64_t objid, TString& clname, Version_t &version);
123  TSQLResult* GetNormalClassDataAll(Long64_t minobjid, Long64_t maxobjid, TSQLClassInfo* sqlinfo);
126  Long64_t StoreObjectInTables(Long64_t keyid, const void* obj, const TClass* cl);
127  Bool_t WriteSpecialObject(Long64_t keyid, TObject* obj, const char* name, const char* title);
128  TObject* ReadSpecialObject(Long64_t keyid, TObject* obj = 0);
129 
130  // sql specific types
131  const char* SQLCompatibleType(Int_t typ) const;
132  const char* SQLIntType() const;
133  const char* SQLSmallTextType() const { return fOtherTypes[0]; }
134  Int_t SQLSmallTextTypeLimit() const { return atoi(fOtherTypes[1]); }
135  const char* SQLBigTextType() const { return fOtherTypes[2]; }
136  const char* SQLDatetimeType() const { return fOtherTypes[3]; }
137  const char* SQLIdentifierQuote() const { return fOtherTypes[4]; }
138  const char* SQLDirIdColumn() const { return fOtherTypes[5]; }
139  const char* SQLKeyIdColumn() const { return fOtherTypes[6]; }
140  const char* SQLObjectIdColumn() const { return fOtherTypes[7]; }
141  const char* SQLRawIdColumn() const { return fOtherTypes[8]; }
142  const char* SQLStrIdColumn() const { return fOtherTypes[9]; }
143  const char* SQLNameSeparator() const { return fOtherTypes[10]; }
144  const char* SQLValueQuote() const { return fOtherTypes[11]; }
145  const char* SQLDefaultTableType() const { return fOtherTypes[12]; }
146 
147  TSQLServer* fSQL; ///<! interface to SQL database
148 
149  TList* fSQLClassInfos; ///<! list of SQL class infos
150 
151  Bool_t fUseSuffixes; ///<! use suffixes in column names like fValue:Int_t or fObject:pointer
152  Int_t fSQLIOversion; ///<! version of SQL I/O which is stored in configurations
153  Int_t fArrayLimit; ///<! limit for array size. when array bigger, its content converted to raw format
154  Bool_t fCanChangeConfig; ///<! variable indicates can be basic configuration changed or not
155  TString fTablesType; ///<! type, used in CREATE TABLE statements
156  Int_t fUseTransactions; ///<! use transaction statements for writing data into the tables
157  Int_t fUseIndexes; ///<! use indexes for tables: 0 - off, 1 - only for basic tables, 2 + normal class tables, 3 - all tables
158  Int_t fModifyCounter; ///<! indicates how many changes was done with database tables
159  Int_t fQuerisCounter; ///<! how many query was applied
160 
161  const char** fBasicTypes; ///<! pointer on list of basic types specific for currently connected SQL server
162  const char** fOtherTypes; ///<! pointer on list of other SQL types like TEXT or blob
163 
164  TString fUserName; ///<! user name, used to access objects from database
165 
166  std::ofstream* fLogFile; ///<! log file with SQL statements
167 
168  Bool_t fIdsTableExists; ///<! indicate if IdsTable exists
169  Int_t fStmtCounter; ///<! count numbers of active statements
170 
171 private:
172  //let the compiler do the job. gcc complains when the following line is activated
173  //TSQLFile(const TSQLFile &) {} //Files cannot be copied
174  void operator=(const TSQLFile &);
175 
176 public:
181  };
182 
188  };
189 
190  TSQLFile();
191  TSQLFile(const char* dbname, Option_t* option = "read", const char* user = "user", const char* pass = "pass");
192  virtual ~TSQLFile();
193 
194  // configuration of SQL
195  Bool_t GetUseSuffixes() const { return fUseSuffixes; }
196  void SetUseSuffixes(Bool_t on = kTRUE);
197  Int_t GetArrayLimit() const { return fArrayLimit; }
198  void SetArrayLimit(Int_t limit = 20);
200  void SetTablesType(const char* table_type);
201  const char* GetTablesType() const { return fTablesType.Data(); }
204  void SetUseIndexes(Int_t use_type = kIndexesBasic);
205  Int_t GetUseIndexes() const { return fUseIndexes; }
207 
210  Bool_t Commit();
211  Bool_t Rollback();
212 
213  // log file for SQL statements
214  void StartLogFile(const char* fname); // *MENU*
215  void StopLogFile(); // *MENU*
216 
217  virtual void Close(Option_t *option=""); // *MENU*
218  virtual TKey* CreateKey(TDirectory* mother, const TObject* obj, const char* name, Int_t bufsize);
219  virtual TKey* CreateKey(TDirectory* mother, const void* obj, const TClass* cl, const char* name, Int_t bufsize);
220  virtual void DrawMap(const char* ="*",Option_t* ="") {}
221  virtual void FillBuffer(char* &) {}
222  virtual void Flush() {}
223 
224  virtual Long64_t GetEND() const { return 0; }
225  virtual Int_t GetErrno() const { return 0; }
226  virtual void ResetErrno() const {}
227 
228  const char* GetDataBaseName() const;
229  virtual Int_t GetNfree() const { return 0; }
230  virtual Int_t GetNbytesInfo() const {return 0; }
231  virtual Int_t GetNbytesFree() const {return 0; }
232  virtual Long64_t GetSeekFree() const {return 0; }
233  virtual Long64_t GetSeekInfo() const {return 0; }
234  virtual Long64_t GetSize() const { return 0; }
235  virtual TList* GetStreamerInfoList();
236 
237  Bool_t IsMySQL() const;
238  virtual Bool_t IsOpen() const;
239  Bool_t IsOracle() const;
240  Bool_t IsODBC() const;
241 
242  virtual void MakeFree(Long64_t, Long64_t) {}
243  virtual void MakeProject(const char *, const char* ="*", Option_t* ="new") {} // *MENU*
244  virtual void Map() {} //
245  virtual void Paint(Option_t* ="") {}
246  virtual void Print(Option_t* ="") const {}
247  virtual Bool_t ReadBuffer(char*, Int_t) { return kFALSE; }
248  virtual Bool_t ReadBuffer(char*, Long64_t, Int_t) { return kFALSE; }
249  virtual void ReadFree() {}
250  virtual Int_t Recover() { return 0; }
251  virtual Int_t ReOpen(Option_t *mode);
252  virtual void Seek(Long64_t, ERelativeTo=kBeg) {}
253 
254  virtual void SetEND(Long64_t) {}
255  virtual Int_t Sizeof() const { return 0; }
256 
257  virtual Bool_t WriteBuffer(const char*, Int_t) { return kFALSE; }
258  virtual Int_t Write(const char* =0, Int_t=0, Int_t=0) { return 0; }
259  virtual Int_t Write(const char* =0, Int_t=0, Int_t=0) const { return 0; }
260  virtual void WriteFree() {}
261  virtual void WriteHeader();
262  virtual void WriteStreamerInfo();
263 
264  ClassDef(TSQLFile,1) // ROOT TFile interface to SQL database
265 };
266 
267 #endif
TSQLResult * GetBlobClassData(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request results for specified objid from streamer classtable.
Definition: TSQLFile.cxx:2486
friend class TSqlRegistry
Definition: TSQLFile.h:36
const char ** fOtherTypes
! pointer on list of other SQL types like TEXT or blob
Definition: TSQLFile.h:162
void StartLogFile(const char *fname)
start logging of all SQL statements in specified file
Definition: TSQLFile.cxx:478
An array of TObjects.
Definition: TObjArray.h:37
Bool_t fCanChangeConfig
! variable indicates can be basic configuration changed or not
Definition: TSQLFile.h:154
Bool_t SQLApplyCommands(TObjArray *cmds)
supplies set of commands to server Commands is stored as array of TObjString
Definition: TSQLFile.cxx:1499
TString CodeLongString(Long64_t objid, Int_t strid)
Produces id which will be placed in column instead of string itself.
Definition: TSQLFile.cxx:2246
Long64_t SQLMaximumValue(const char *tablename, const char *columnname)
Returns maximum value, found in specified columnname of table tablename Column type should be numeric...
Definition: TSQLFile.cxx:1534
Int_t StreamKeysForDirectory(TDirectory *dir, Bool_t doupdate, Long64_t specialkeyid=-1, TKeySQL **specialkey=0)
read keys for specified directory (when update == kFALSE) or update value for modified keys when upda...
Definition: TSQLFile.cxx:938
void InitSqlDatabase(Bool_t create)
initialize sql database and correspondent structures identical to TFile::Init() function ...
Definition: TSQLFile.cxx:1017
const char * SQLCompatibleType(Int_t typ) const
Returns sql type name which is most closer to ROOT basic type.
Definition: TSQLFile.cxx:2580
void StopLogFile()
close logging file
Definition: TSQLFile.cxx:487
long long Long64_t
Definition: RtypesCore.h:69
virtual Int_t Recover()
Attempt to recover file if not correctly closed.
Definition: TSQLFile.h:250
Bool_t SQLCommit()
Commit SQL transaction.
Definition: TSQLFile.cxx:1600
const char * SQLRawIdColumn() const
Definition: TSQLFile.h:141
TSQLResult * GetNormalClassDataAll(Long64_t minobjid, Long64_t maxobjid, TSQLClassInfo *sqlinfo)
Return data for several objects from the range from normal class table.
Definition: TSQLFile.cxx:2471
short Version_t
Definition: RtypesCore.h:61
std::ofstream * fLogFile
! log file with SQL statements
Definition: TSQLFile.h:166
TSQLResult * GetNormalClassData(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request result for specified objid from normal classtable.
Definition: TSQLFile.cxx:2457
ELockingKinds
Definition: TSQLFile.h:41
virtual Int_t SysRead(Int_t, void *, Int_t)
Interface to system read. All arguments like in POSIX read().
Definition: TSQLFile.h:49
const char Option_t
Definition: RtypesCore.h:62
TString fUserName
! user name, used to access objects from database
Definition: TSQLFile.h:164
Bool_t Rollback()
Rollback all operations, done after StartTransaction() call.
Definition: TSQLFile.cxx:620
virtual Int_t ReOpen(Option_t *mode)
Reopen a file with a different access mode, like from READ to See TFile::Open() for details...
Definition: TSQLFile.cxx:748
TSQLServer * fSQL
! interface to SQL database
Definition: TSQLFile.h:147
const char * SQLDatetimeType() const
Definition: TSQLFile.h:136
virtual Int_t SysStat(Int_t, Long_t *, Long64_t *, Long_t *, Long_t *)
Return file stat information.
Definition: TSQLFile.h:52
TString fTablesType
! type, used in CREATE TABLE statements
Definition: TSQLFile.h:155
TSQLFile()
default TSQLFile constructor
Definition: TSQLFile.cxx:279
virtual void DirWriteHeader(TDirectory *)
Update dir header in the file.
Definition: TSQLFile.cxx:2632
virtual void Paint(Option_t *="")
Paint all objects in the file.
Definition: TSQLFile.h:245
Int_t fUseTransactions
! use transaction statements for writing data into the tables
Definition: TSQLFile.h:156
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:46
Bool_t SQLStartTransaction()
Start SQL transaction.
Definition: TSQLFile.cxx:1592
void SQLDeleteStatement(TSQLStatement *stmt)
delete statement and decrease counter
Definition: TSQLFile.cxx:1486
const char * GetTablesType() const
Definition: TSQLFile.h:201
virtual Int_t SysSync(Int_t)
Interface to system fsync. All arguments like in POSIX fsync().
Definition: TSQLFile.h:53
Int_t IsLongStringCode(Long64_t objid, const char *value)
Checks if this is long string code returns 0, if not or string id.
Definition: TSQLFile.cxx:2257
Int_t GetQuerisCounter() const
Definition: TSQLFile.h:206
Contains information about tables specific to one class and version.
Definition: TSQLClassInfo.h:44
Basic string class.
Definition: TString.h:129
Bool_t UpdateKeyData(TKeySQL *key)
Updates (overwrites) key data in KeysTable.
Definition: TSQLFile.cxx:1740
int Int_t
Definition: RtypesCore.h:41
Long64_t StoreObjectInTables(Long64_t keyid, const void *obj, const TClass *cl)
Store object in database. Return stored object id or -1 if error.
Definition: TSQLFile.cxx:2533
bool Bool_t
Definition: RtypesCore.h:59
virtual void Flush()
Synchronize a file&#39;s in-memory and on-disk states.
Definition: TSQLFile.h:222
const char * SQLStrIdColumn() const
Definition: TSQLFile.h:142
TSQLClassInfo * RequestSQLClassInfo(const char *clname, Int_t version)
Search in database tables for specified class and return TSQLClassInfo object.
Definition: TSQLFile.cxx:1816
ERelativeTo
Definition: TFile.h:171
virtual Bool_t ReadBuffer(char *, Long64_t, Int_t)
Read a buffer from the file at the offset &#39;pos&#39; in the file.
Definition: TSQLFile.h:248
Int_t fStmtCounter
! count numbers of active statements
Definition: TSQLFile.h:169
void CreateBasicTables()
Creates initial tables in database This is table with configurations and table with keys Function cal...
Definition: TSQLFile.cxx:1134
friend class TSqlCmdsBuffer
Definition: TSQLFile.h:38
Bool_t ReadConfigurations()
read table configurations as special table
Definition: TSQLFile.cxx:1071
virtual Int_t GetNbytesFree() const
Definition: TSQLFile.h:231
virtual Int_t Write(const char *=0, Int_t=0, Int_t=0) const
One can not save a const TDirectory object.
Definition: TSQLFile.h:259
Bool_t HasTable(const char *name)
Test if table name exists.
Definition: TSQLFile.cxx:1894
Int_t fQuerisCounter
! how many query was applied
Definition: TSQLFile.h:159
virtual Long64_t GetEND() const
Definition: TSQLFile.h:224
virtual void FillBuffer(char *&)
Encode file output buffer.
Definition: TSQLFile.h:221
virtual void DrawMap(const char *="*", Option_t *="")
Draw map of objects in this file.
Definition: TSQLFile.h:220
Int_t fSQLIOversion
! version of SQL I/O which is stored in configurations
Definition: TSQLFile.h:152
Bool_t StartTransaction()
Start user transaction.
Definition: TSQLFile.cxx:592
virtual Int_t GetNfree() const
Definition: TSQLFile.h:229
const char ** fBasicTypes
! pointer on list of basic types specific for currently connected SQL server
Definition: TSQLFile.h:161
Bool_t GetUseSuffixes() const
Definition: TSQLFile.h:195
virtual Int_t GetErrno() const
Method returning errno. Is overriden in TRFIOFile.
Definition: TSQLFile.h:225
Int_t GetUseTransactions() const
Definition: TSQLFile.h:203
#define ClassDef(name, id)
Definition: Rtypes.h:297
void SetLocking(Int_t mode)
Set locking mode for current database.
Definition: TSQLFile.cxx:1367
Bool_t ProduceClassSelectQuery(TVirtualStreamerInfo *info, TSQLClassInfo *sqlinfo, TString &columns, TString &tables, Int_t &tablecnt)
used by MakeClassSelectQuery method to add columns from table of class, specified by TVirtualStreamer...
Definition: TSQLFile.cxx:1266
Int_t SQLSmallTextTypeLimit() const
Definition: TSQLFile.h:134
EIndexesKinds
Definition: TSQLFile.h:183
TSQLResult * SQLQuery(const char *cmd, Int_t flag=0, Bool_t *res=0)
Submits query to SQL server.
Definition: TSQLFile.cxx:1426
This is hierarhical structure, which is created when data is written by TBufferSQL2.
void SkipArrayLimit()
Definition: TSQLFile.h:199
Int_t fModifyCounter
! indicates how many changes was done with database tables
Definition: TSQLFile.h:158
Bool_t CreateClassTable(TSQLClassInfo *sqlinfo, TObjArray *colinfos)
Create normal class table if required.
Definition: TSQLFile.cxx:2075
const char * SQLKeyIdColumn() const
Definition: TSQLFile.h:139
virtual Int_t SysClose(Int_t)
Interface to system close. All arguments like in POSIX close().
Definition: TSQLFile.h:48
TSQLStatement * SQLStatement(const char *cmd, Int_t bufsize=1000)
Produces SQL statement for currently conected DB server.
Definition: TSQLFile.cxx:1468
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:24
Bool_t IsTablesExists()
Checks if main keys table is existing.
Definition: TSQLFile.cxx:1351
virtual void DirWriteKeys(TDirectory *)
Write directory keys list to database.
Definition: TSQLFile.cxx:2624
virtual Bool_t IsOpen() const
return kTRUE if file is opened and can be accessed
Definition: TSQLFile.cxx:739
void IncrementModifyCounter()
Update value of modify counter in config table Modify counter used to indicate that something was cha...
Definition: TSQLFile.cxx:1216
virtual Int_t Write(const char *=0, Int_t=0, Int_t=0)
Write memory objects to this file.
Definition: TSQLFile.h:258
Bool_t SQLCanStatement()
Test if DB support statement and number of open statements is not exceeded.
Definition: TSQLFile.cxx:1456
Long64_t DefineNextKeyId()
Returns next possible key identifier.
Definition: TSQLFile.cxx:1776
Bool_t GetLongString(Long64_t objid, Int_t strid, TString &value)
Returns value of string, extracted from special table, where long strings are stored.
Definition: TSQLFile.cxx:2294
Int_t GetArrayLimit() const
Definition: TSQLFile.h:197
virtual Long64_t GetSeekFree() const
Definition: TSQLFile.h:232
Bool_t WriteKeyData(TKeySQL *key)
Add entry into keys table.
Definition: TSQLFile.cxx:1709
const char * GetDataBaseName() const
Return name of data base on the host For Oracle always return 0.
Definition: TSQLFile.cxx:654
A doubly linked list.
Definition: TList.h:43
const char * SQLDirIdColumn() const
Definition: TSQLFile.h:138
void ReadSQLClassInfos()
Read all class infos from IdsTable.
Definition: TSQLFile.cxx:1919
void AddIdEntry(Long64_t tableid, Int_t subid, Int_t type, const char *name, const char *sqlname, const char *info)
Add entry into IdsTable, where all tables names and columns names are listed.
Definition: TSQLFile.cxx:2029
virtual TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize)
create SQL key, which will store object in data base
Definition: TSQLFile.cxx:795
virtual void Print(Option_t *="") const
Print all objects in the file.
Definition: TSQLFile.h:246
virtual Int_t SysWrite(Int_t, const void *, Int_t)
Interface to system write. All arguments like in POSIX write().
Definition: TSQLFile.h:50
TString DefineTableName(const char *clname, Int_t version, Bool_t rawtable)
Proposes table name for class.
Definition: TSQLFile.cxx:1848
virtual ~TSQLFile()
destructor of TSQLFile object
Definition: TSQLFile.cxx:712
Access an SQL db via the TFile interface.
Definition: TSQLFile.h:30
Bool_t Commit()
Commit transaction, started by StartTransaction() call.
Definition: TSQLFile.cxx:606
virtual void Map()
List the contents of a file sequentially.
Definition: TSQLFile.h:244
TSQLClassInfo * FindSQLClassInfo(const char *clname, Int_t version)
Return (if exists) TSQLClassInfo for specified class name and version.
Definition: TSQLFile.cxx:1791
Bool_t IsODBC() const
checks, if ODBC driver used for database connection
Definition: TSQLFile.cxx:516
virtual void WriteFree()
Write FREE linked list on the file.
Definition: TSQLFile.h:260
virtual void ReadFree()
Read the FREE linked list.
Definition: TSQLFile.h:249
TSQLStatement * GetBlobClassDataStmt(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request results for specified objid from streamer classtable Data returned in form of s...
Definition: TSQLFile.cxx:2503
friend class TSqlRawBuffer
Definition: TSQLFile.h:37
virtual TList * GetStreamerInfoList()
Read back streamer infos from database List of streamer infos is always stored with key:id 0...
Definition: TSQLFile.cxx:906
Bool_t SQLRollback()
Rollback all SQL operations, done after start transaction.
Definition: TSQLFile.cxx:1608
unsigned int UInt_t
Definition: RtypesCore.h:42
TObjArray * SQLObjectsInfo(Long64_t keyid)
Produce array of TSQLObjectInfo objects for all objects, belong to that key Array should be deleted b...
Definition: TSQLFile.cxx:2394
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
void SetUseIndexes(Int_t use_type=kIndexesBasic)
Specify usage of indexes for data tables Index Description kIndexesNone = 0 no indexes are used kInd...
Definition: TSQLFile.cxx:642
void operator=(const TSQLFile &)
make private to exclude copy operator
Definition: TSQLFile.cxx:732
TString MakeSelectQuery(TClass *cl)
Produce SELECT statement which can be used to get all data of class cl in one SELECT statement...
Definition: TSQLFile.cxx:1245
void DeleteKeyFromDB(Long64_t keyid)
Remove key with specified id from keys table also removes all objects data, related to this table...
Definition: TSQLFile.cxx:1630
const Bool_t kFALSE
Definition: RtypesCore.h:92
void SetArrayLimit(Int_t limit=20)
Defines maximum number of columns for array representation If array size bigger than limit...
Definition: TSQLFile.cxx:543
virtual Long64_t GetSize() const
Returns the current file size.
Definition: TSQLFile.h:234
const char * SQLBigTextType() const
Definition: TSQLFile.h:135
Converts data to SQL statements or read data from SQL tables.
Definition: TBufferSQL2.h:30
long Long_t
Definition: RtypesCore.h:50
Bool_t IsOracle() const
checks, if Oracle database
Definition: TSQLFile.cxx:507
Bool_t CreateRawTable(TSQLClassInfo *sqlinfo)
Create the raw table.
Definition: TSQLFile.cxx:2164
Int_t GetLocking()
Return current locking mode for that file.
Definition: TSQLFile.cxx:1384
const char * SQLValueQuote() const
Definition: TSQLFile.h:144
ETransactionKinds
Definition: TSQLFile.h:177
virtual Bool_t WriteBuffer(const char *, Int_t)
Write a buffer to the file.
Definition: TSQLFile.h:257
Describe directory structure in memory.
Definition: TDirectory.h:34
virtual void MakeProject(const char *, const char *="*", Option_t *="new")
Generate source code necessary to access the objects stored in the file.
Definition: TSQLFile.h:243
int type
Definition: TGX11.cxx:120
Bool_t SQLTestTable(const char *tablename)
Test, if table of specified name exists.
Definition: TSQLFile.cxx:1517
virtual Bool_t ReadBuffer(char *, Int_t)
Read a buffer from the file.
Definition: TSQLFile.h:247
virtual void Seek(Long64_t, ERelativeTo=kBeg)
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
Definition: TSQLFile.h:252
const char * SQLNameSeparator() const
Definition: TSQLFile.h:143
Bool_t IsMySQL() const
checks, if MySQL database
Definition: TSQLFile.cxx:498
Mother of all ROOT objects.
Definition: TObject.h:37
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...
Definition: TSQLFile.cxx:855
void SetTablesType(const char *table_type)
Defines tables type, which is used in CREATE TABLE statements Now is only used for MySQL database...
Definition: TSQLFile.cxx:557
void SaveToDatabase()
save data which is not yet in Database Typically this is streamerinfos structures or ...
Definition: TSQLFile.cxx:925
void SetUseTransactions(Int_t mode=kTransactionsAuto)
Defines usage of transactions statements for writing objects data to database.
Definition: TSQLFile.cxx:575
Bool_t fIdsTableExists
! indicate if IdsTable exists
Definition: TSQLFile.h:168
virtual void MakeFree(Long64_t, Long64_t)
Mark unused bytes on the file.
Definition: TSQLFile.h:242
Bool_t SQLObjectInfo(Long64_t objid, TString &clname, Version_t &version)
Read from objects table data for specified objectid.
Definition: TSQLFile.cxx:2366
virtual void WriteStreamerInfo()
Store all TVirtualStreamerInfo, used in file, in sql database.
Definition: TSQLFile.cxx:819
virtual void ResetErrno() const
Method resetting the errno. Is overridden in TRFIOFile.
Definition: TSQLFile.h:226
Bool_t VerifyLongStringTable()
Checks that table for big strings is exists If not, will be created.
Definition: TSQLFile.cxx:2218
const char * SQLObjectIdColumn() const
Definition: TSQLFile.h:140
virtual Long64_t DirCreateEntry(TDirectory *)
Create entry for directory in database.
Definition: TSQLFile.cxx:2596
virtual Long64_t GetSeekInfo() const
Definition: TSQLFile.h:233
virtual Int_t SysOpen(const char *, Int_t, UInt_t)
Interface to system open. All arguments like in POSIX open().
Definition: TSQLFile.h:47
TKeySQL represents metainforamtion about object, which was written to SQL database.
Definition: TKeySQL.h:20
TObject * ReadSpecialObject(Long64_t keyid, TObject *obj=0)
Read data of special kind of objects.
Definition: TSQLFile.cxx:878
virtual void WriteHeader()
Write file info like configurations, title, UUID and other.
Definition: TSQLFile.cxx:811
Bool_t IsReadAccess()
dummy, in future should check about read access to database
Definition: TSQLFile.cxx:1410
virtual Int_t Sizeof() const
Return the size in bytes of the file header.
Definition: TSQLFile.h:255
TKeySQL * FindSQLKey(TDirectory *dir, Long64_t keyid)
Search for TKeySQL object with specified keyid.
Definition: TSQLFile.cxx:1690
Bool_t fUseSuffixes
! use suffixes in column names like fValue:Int_t or fObject:pointer
Definition: TSQLFile.h:151
TList * fSQLClassInfos
! list of SQL class infos
Definition: TSQLFile.h:149
const char * SQLSmallTextType() const
Definition: TSQLFile.h:133
void SQLDeleteAllTables()
Delete all tables in database.
Definition: TSQLFile.cxx:1570
void SetUseSuffixes(Bool_t on=kTRUE)
enable/disable uasge of suffixes in columns names can be changed before first object is saved into fi...
Definition: TSQLFile.cxx:527
Abstract Interface class describing Streamer information for one class.
Int_t SQLMaxIdentifierLength()
returns maximum allowed length of identifiers
Definition: TSQLFile.cxx:1616
virtual Int_t DirReadKeys(TDirectory *)
Read directory list of keys from database.
Definition: TSQLFile.cxx:2610
const Bool_t kTRUE
Definition: RtypesCore.h:91
Int_t fUseIndexes
! use indexes for tables: 0 - off, 1 - only for basic tables, 2 + normal class tables, 3 - all tables
Definition: TSQLFile.h:157
Int_t fArrayLimit
! limit for array size. when array bigger, its content converted to raw format
Definition: TSQLFile.h:153
const char * SQLIntType() const
return SQL integer type
Definition: TSQLFile.cxx:2588
Int_t GetUseIndexes() const
Definition: TSQLFile.h:205
const char * SQLDefaultTableType() const
Definition: TSQLFile.h:145
virtual Long64_t SysSeek(Int_t, Long64_t, Int_t)
Interface to system lseek.
Definition: TSQLFile.h:51
virtual void SetEND(Long64_t)
Definition: TSQLFile.h:254
const char * SQLIdentifierQuote() const
Definition: TSQLFile.h:137
virtual Int_t GetNbytesInfo() const
Definition: TSQLFile.h:230
virtual void Close(Option_t *option="")
Close a SQL file For more comments see TFile::Close() function.
Definition: TSQLFile.cxx:666
Bool_t IsWriteAccess()
Checkis, if lock is free in configuration tables.
Definition: TSQLFile.cxx:1359
Long64_t VerifyObjectTable()
Checks that objects table is exists If not, table will be created Returns maximum value for existing ...
Definition: TSQLFile.cxx:2323
const char * Data() const
Definition: TString.h:347