Logo ROOT  
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 final : 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:
41  enum ELockingKinds { kLockFree = 0, kLockBusy = 1 };
42 
43  // Interface to basic system I/O routines, suppressed
44  Int_t SysOpen(const char *, Int_t, UInt_t) final { return 0; }
45  Int_t SysClose(Int_t) final { return 0; }
46  Int_t SysRead(Int_t, void *, Int_t) final { return 0; }
47  Int_t SysWrite(Int_t, const void *, Int_t) final { return 0; }
48  Long64_t SysSeek(Int_t, Long64_t, Int_t) final { return 0; }
49  Int_t SysStat(Int_t, Long_t *, Long64_t *, Long_t *, Long_t *) final { return 0; }
50  Int_t SysSync(Int_t) final { return 0; }
51 
52  // Overwrite methods for directory I/O
54  Int_t DirReadKeys(TDirectory *) final;
55  void DirWriteKeys(TDirectory *) final;
56  void DirWriteHeader(TDirectory *) final;
57 
58  InfoListRet GetStreamerInfoListImpl(bool) final;
59 
60  // functions to manipulate basic tables (Configurations, Objects, Keys) in database
61  void SaveToDatabase();
64  void InitSqlDatabase(Bool_t create);
65  void CreateBasicTables();
67  void SetLocking(Int_t mode);
68  Int_t GetLocking();
69 
70  // function for read/write access infos
73 
74  // generic sql functions
75  TSQLResult *SQLQuery(const char *cmd, Int_t flag = 0, Bool_t *res = 0);
77  TSQLStatement *SQLStatement(const char *cmd, Int_t bufsize = 1000);
80  Bool_t SQLTestTable(const char *tablename);
81  Long64_t SQLMaximumValue(const char *tablename, const char *columnname);
82  void SQLDeleteAllTables();
84  Bool_t SQLCommit();
87 
88  // operation with keys structures in database
89  void DeleteKeyFromDB(Long64_t keyid);
92  TKeySQL *FindSQLKey(TDirectory *dir, Long64_t keyid);
94  Int_t StreamKeysForDirectory(TDirectory *dir, Bool_t doupdate, Long64_t specialkeyid = -1, TKeySQL **specialkey = 0);
95 
96  // handling SQL class info structures
97  TSQLClassInfo *FindSQLClassInfo(const char *clname, Int_t version);
99  TSQLClassInfo *RequestSQLClassInfo(const char *clname, Int_t version);
101  Bool_t CreateClassTable(TSQLClassInfo *sqlinfo, TObjArray *colinfos);
103 
105  Int_t &tablecnt);
106  void AddIdEntry(Long64_t tableid, Int_t subid, Int_t type, const char *name, const char *sqlname, const char *info);
107  void ReadSQLClassInfos();
108  TString DefineTableName(const char *clname, Int_t version, Bool_t rawtable);
109  Bool_t HasTable(const char *name);
110 
111  // operations with long string table
112  TString CodeLongString(Long64_t objid, Int_t strid);
113  Int_t IsLongStringCode(Long64_t objid, const char *value);
115  Bool_t GetLongString(Long64_t objid, Int_t strid, TString &value);
116 
117  // operation with object tables in database
119  Bool_t SQLObjectInfo(Long64_t objid, TString &clname, Version_t &version);
122  TSQLResult *GetNormalClassDataAll(Long64_t minobjid, Long64_t maxobjid, TSQLClassInfo *sqlinfo);
125  Long64_t StoreObjectInTables(Long64_t keyid, const void *obj, const TClass *cl);
126  Bool_t WriteSpecialObject(Long64_t keyid, TObject *obj, const char *name, const char *title);
127  TObject *ReadSpecialObject(Long64_t keyid, TObject *obj = 0);
128 
129  // sql specific types
130  const char *SQLCompatibleType(Int_t typ) const;
131  const char *SQLIntType() const;
132  const char *SQLSmallTextType() const { return fOtherTypes[0]; }
133  Int_t SQLSmallTextTypeLimit() const { return atoi(fOtherTypes[1]); }
134  const char *SQLBigTextType() const { return fOtherTypes[2]; }
135  const char *SQLDatetimeType() const { return fOtherTypes[3]; }
136  const char *SQLIdentifierQuote() const { return fOtherTypes[4]; }
137  const char *SQLDirIdColumn() const { return fOtherTypes[5]; }
138  const char *SQLKeyIdColumn() const { return fOtherTypes[6]; }
139  const char *SQLObjectIdColumn() const { return fOtherTypes[7]; }
140  const char *SQLRawIdColumn() const { return fOtherTypes[8]; }
141  const char *SQLStrIdColumn() const { return fOtherTypes[9]; }
142  const char *SQLNameSeparator() const { return fOtherTypes[10]; }
143  const char *SQLValueQuote() const { return fOtherTypes[11]; }
144  const char *SQLDefaultTableType() const { return fOtherTypes[12]; }
145 
146  TSQLServer *fSQL; ///<! interface to SQL database
147 
148  TList *fSQLClassInfos; ///<! list of SQL class infos
149 
150  Bool_t fUseSuffixes; ///<! use suffixes in column names like fValue:Int_t or fObject:pointer
151  Int_t fSQLIOversion; ///<! version of SQL I/O which is stored in configurations
152  Int_t fArrayLimit; ///<! limit for array size. when array bigger, its content converted to raw format
153  Bool_t fCanChangeConfig; ///<! variable indicates can be basic configuration changed or not
154  TString fTablesType; ///<! type, used in CREATE TABLE statements
155  Int_t fUseTransactions; ///<! use transaction statements for writing data into the tables
156  Int_t fUseIndexes; ///<! use indexes for tables: 0 - off, 1 - only for basic tables, 2 + normal class tables, 3 - all tables
157  Int_t fModifyCounter; ///<! indicates how many changes was done with database tables
158  Int_t fQuerisCounter; ///<! how many query was applied
159 
160  const char **fBasicTypes; ///<! pointer on list of basic types specific for currently connected SQL server
161  const char **fOtherTypes; ///<! pointer on list of other SQL types like TEXT or blob
162 
163  TString fUserName; ///<! user name, used to access objects from database
164 
165  std::ofstream *fLogFile; ///<! log file with SQL statements
166 
167  Bool_t fIdsTableExists; ///<! indicate if IdsTable exists
168  Int_t fStmtCounter; ///<! count numbers of active statements
169 
170 private:
171  TSQLFile(const TSQLFile &) = delete; //Files cannot be copied - not implemented
172  void operator=(const TSQLFile &) = delete; //Files cannot be copied - not implemented
173 
174 public:
176 
178 
179  TSQLFile();
180  TSQLFile(const char *dbname, Option_t *option = "read", const char *user = "user", const char *pass = "pass");
181  virtual ~TSQLFile();
182 
183  // configuration of SQL
184  Bool_t GetUseSuffixes() const { return fUseSuffixes; }
185  void SetUseSuffixes(Bool_t on = kTRUE);
186  Int_t GetArrayLimit() const { return fArrayLimit; }
187  void SetArrayLimit(Int_t limit = 20);
189  void SetTablesType(const char *table_type);
190  const char *GetTablesType() const { return fTablesType.Data(); }
193  void SetUseIndexes(Int_t use_type = kIndexesBasic);
194  Int_t GetUseIndexes() const { return fUseIndexes; }
196  Int_t GetIOVersion() const { return fSQLIOversion; }
197 
200  Bool_t Commit();
201  Bool_t Rollback();
202 
203  // log file for SQL statements
204  void StartLogFile(const char *fname); // *MENU*
205  void StopLogFile(); // *MENU*
206 
207  void Close(Option_t *option = "") final; // *MENU*
208  TKey *CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize) final;
209  TKey *CreateKey(TDirectory *mother, const void *obj, const TClass *cl, const char *name, Int_t bufsize) final;
210  void DrawMap(const char * = "*", Option_t * = "") final {}
211  void FillBuffer(char *&) final {}
212  void Flush() final {}
213 
214  Long64_t GetEND() const final { return 0; }
215  Int_t GetErrno() const final { return 0; }
216  void ResetErrno() const final {}
217 
218  const char *GetDataBaseName() const;
219  Int_t GetNfree() const final { return 0; }
220  Int_t GetNbytesInfo() const final{ return 0; }
221  Int_t GetNbytesFree() const final { return 0; }
222  Long64_t GetSeekFree() const final { return 0; }
223  Long64_t GetSeekInfo() const final { return 0; }
224  Long64_t GetSize() const final { return 0; }
225 
226  Bool_t IsOpen() const final;
227  Bool_t IsMySQL() const;
228  Bool_t IsOracle() const;
229  Bool_t IsODBC() const;
230 
231  void MakeFree(Long64_t, Long64_t) final {}
232  void MakeProject(const char *, const char * = "*", Option_t * = "new") final {} // *MENU*
233  void Map(Option_t *) final {} //
234  void Map() final {} //
235  void Paint(Option_t * = "") final {}
236  void Print(Option_t * = "") const final {}
237  Bool_t ReadBuffer(char *, Int_t) final { return kFALSE; }
238  Bool_t ReadBuffer(char *, Long64_t, Int_t) final { return kFALSE; }
239  void ReadFree() final {}
240  Int_t Recover() final { return 0; }
241  Int_t ReOpen(Option_t *mode) final;
242  void Seek(Long64_t, ERelativeTo = kBeg) final {}
243 
244  void SetEND(Long64_t) final {}
245  Int_t Sizeof() const final { return 0; }
246 
247  Bool_t WriteBuffer(const char *, Int_t) final { return kFALSE; }
248  Int_t Write(const char * = nullptr, Int_t = 0, Int_t = 0) final { return 0; }
249  Int_t Write(const char * = nullptr, Int_t = 0, Int_t = 0) const final { return 0; }
250  void WriteFree() final {}
251  void WriteHeader() final;
252  void WriteStreamerInfo() final;
253 
254  ClassDefOverride(TSQLFile, 1) // ROOT TFile interface to SQL database
255 };
256 
257 #endif
TSQLFile::WriteFree
void WriteFree() final
Write FREE linked list on the file.
Definition: TSQLFile.h:250
TSQLFile::kIndexesAll
@ kIndexesAll
Definition: TSQLFile.h:177
TSQLFile::SetLocking
void SetLocking(Int_t mode)
Set locking mode for current database.
Definition: TSQLFile.cxx:1335
TSQLFile::fSQL
TSQLServer * fSQL
! interface to SQL database
Definition: TSQLFile.h:146
TSQLFile::fQuerisCounter
Int_t fQuerisCounter
! how many query was applied
Definition: TSQLFile.h:158
TSQLFile::Map
void Map() final
Definition: TSQLFile.h:234
TKeySQL
TKeySQL represents meta-information about object, which was written to SQL database.
Definition: TKeySQL.h:19
TSQLFile::GetNormalClassDataAll
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:2450
TSQLFile::WriteHeader
void WriteHeader() final
Write file info like configurations, title, UUID and other.
Definition: TSQLFile.cxx:783
TSQLFile::kTransactionsAuto
@ kTransactionsAuto
Definition: TSQLFile.h:175
TSQLFile::TSqlCmdsBuffer
friend class TSqlCmdsBuffer
Definition: TSQLFile.h:38
TSQLFile::GetDataBaseName
const char * GetDataBaseName() const
Return name of data base on the host For Oracle always return 0.
Definition: TSQLFile.cxx:628
TSQLFile::IsMySQL
Bool_t IsMySQL() const
checks, if MySQL database
Definition: TSQLFile.cxx:468
TSQLFile::GetNbytesInfo
Int_t GetNbytesInfo() const final
Definition: TSQLFile.h:220
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TSQLFile::ReadSQLClassInfos
void ReadSQLClassInfos()
Read all class infos from IdsTable.
Definition: TSQLFile.cxx:1912
TSQLFile::ResetErrno
void ResetErrno() const final
Method resetting the errno.
Definition: TSQLFile.h:216
TSQLFile::Write
Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) const final
One can not save a const TDirectory object.
Definition: TSQLFile.h:249
Version_t
short Version_t
Definition: RtypesCore.h:65
TSQLFile::GetSeekInfo
Long64_t GetSeekInfo() const final
Definition: TSQLFile.h:223
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
TSQLFile::IsOracle
Bool_t IsOracle() const
checks, if Oracle database
Definition: TSQLFile.cxx:478
TSQLFile::Paint
void Paint(Option_t *="") final
Paint all objects in the file.
Definition: TSQLFile.h:235
TSQLFile::SQLDirIdColumn
const char * SQLDirIdColumn() const
Definition: TSQLFile.h:137
Option_t
const char Option_t
Definition: RtypesCore.h:66
TSQLFile::SysClose
Int_t SysClose(Int_t) final
Interface to system close. All arguments like in POSIX close().
Definition: TSQLFile.h:45
TSQLFile::GetNbytesFree
Int_t GetNbytesFree() const final
Definition: TSQLFile.h:221
TSQLFile::GetLongString
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:2275
TSQLClassInfo
Contains information about tables specific to one class and version.
Definition: TSQLClassInfo.h:41
TFile::kBeg
@ kBeg
Definition: TFile.h:191
TSQLFile::GetNormalClassData
TSQLResult * GetNormalClassData(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request result for specified objid from normal classtable.
Definition: TSQLFile.cxx:2436
TString::Data
const char * Data() const
Definition: TString.h:369
TSQLFile::GetBlobClassDataStmt
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:2481
TSQLFile::SQLValueQuote
const char * SQLValueQuote() const
Definition: TSQLFile.h:143
TSQLFile::GetIOVersion
Int_t GetIOVersion() const
Definition: TSQLFile.h:196
TSQLFile::GetErrno
Int_t GetErrno() const final
Method returning errno.
Definition: TSQLFile.h:215
TSQLFile::DirReadKeys
Int_t DirReadKeys(TDirectory *) final
Read directory list of keys from database.
Definition: TSQLFile.cxx:2598
TSQLFile::MakeProject
void MakeProject(const char *, const char *="*", Option_t *="new") final
Generate source code necessary to access the objects stored in the file.
Definition: TSQLFile.h:232
TSQLFile::DirCreateEntry
Long64_t DirCreateEntry(TDirectory *) final
Create entry for directory in database.
Definition: TSQLFile.cxx:2583
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
TSQLFile::Commit
Bool_t Commit()
Commit transaction, started by StartTransaction() call.
Definition: TSQLFile.cxx:580
TSQLFile::kTransactionsOff
@ kTransactionsOff
Definition: TSQLFile.h:175
TSQLFile::fModifyCounter
Int_t fModifyCounter
! indicates how many changes was done with database tables
Definition: TSQLFile.h:157
TSQLFile::SQLStartTransaction
Bool_t SQLStartTransaction()
Start SQL transaction.
Definition: TSQLFile.cxx:1574
TSQLFile::SQLKeyIdColumn
const char * SQLKeyIdColumn() const
Definition: TSQLFile.h:138
TFile::ERelativeTo
ERelativeTo
Definition: TFile.h:191
TSQLFile::fArrayLimit
Int_t fArrayLimit
! limit for array size. when array bigger, its content converted to raw format
Definition: TSQLFile.h:152
TSQLFile::IsLongStringCode
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:2226
TSQLFile::Close
void Close(Option_t *option="") final
Close a SQL file For more comments see TFile::Close() function.
Definition: TSQLFile.cxx:642
TSQLFile::Write
Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) final
Write memory objects to this file.
Definition: TSQLFile.h:248
TSQLFile::DirWriteHeader
void DirWriteHeader(TDirectory *) final
Update dir header in the file.
Definition: TSQLFile.cxx:2620
TSQLFile::operator=
void operator=(const TSQLFile &)=delete
Int_t
int Int_t
Definition: RtypesCore.h:45
TSQLFile::SQLBigTextType
const char * SQLBigTextType() const
Definition: TSQLFile.h:134
TSQLFile::SQLStrIdColumn
const char * SQLStrIdColumn() const
Definition: TSQLFile.h:141
TSQLFile::GetArrayLimit
Int_t GetArrayLimit() const
Definition: TSQLFile.h:186
TSQLFile::TSQLFile
TSQLFile()
default TSQLFile constructor
Definition: TSQLFile.cxx:271
TSQLFile::SQLDeleteStatement
void SQLDeleteStatement(TSQLStatement *stmt)
delete statement and decrease counter
Definition: TSQLFile.cxx:1460
TSQLFile::kIndexesBasic
@ kIndexesBasic
Definition: TSQLFile.h:177
TSQLStructure
This is hierarchical structure, which is created when data is written by TBufferSQL2.
Definition: TSQLStructure.h:88
TSQLFile::ReadBuffer
Bool_t ReadBuffer(char *, Int_t) final
Read a buffer from the file.
Definition: TSQLFile.h:237
TSQLFile::Print
void Print(Option_t *="") const final
Print all objects in the file.
Definition: TSQLFile.h:236
TSQLFile::SysOpen
Int_t SysOpen(const char *, Int_t, UInt_t) final
Interface to system open. All arguments like in POSIX open().
Definition: TSQLFile.h:44
TSQLFile::kLockBusy
@ kLockBusy
Definition: TSQLFile.h:41
TSQLFile::SetArrayLimit
void SetArrayLimit(Int_t limit=20)
Defines maximum number of columns for array representation If array size bigger than limit,...
Definition: TSQLFile.cxx:515
TSQLFile::DefineNextKeyId
Long64_t DefineNextKeyId()
Returns next possible key identifier.
Definition: TSQLFile.cxx:1758
TSQLFile::SQLSmallTextType
const char * SQLSmallTextType() const
Definition: TSQLFile.h:132
TSQLFile::fUseTransactions
Int_t fUseTransactions
! use transaction statements for writing data into the tables
Definition: TSQLFile.h:155
TSQLFile::Seek
void Seek(Long64_t, ERelativeTo=kBeg) final
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
Definition: TSQLFile.h:242
TSQLFile::GetUseSuffixes
Bool_t GetUseSuffixes() const
Definition: TSQLFile.h:184
TSQLFile::RequestSQLClassInfo
TSQLClassInfo * RequestSQLClassInfo(const char *clname, Int_t version)
Search in database tables for specified class and return TSQLClassInfo object.
Definition: TSQLFile.cxx:1801
TString
Basic string class.
Definition: TString.h:136
ClassDefOverride
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
TSQLFile::ReadBuffer
Bool_t ReadBuffer(char *, Long64_t, Int_t) final
Read a buffer from the file at the offset 'pos' in the file.
Definition: TSQLFile.h:238
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TSQLFile::GetEND
Long64_t GetEND() const final
Definition: TSQLFile.h:214
TFile.h
TVirtualStreamerInfo
Abstract Interface class describing Streamer information for one class.
Definition: TVirtualStreamerInfo.h:37
bool
TSQLFile::FindSQLClassInfo
TSQLClassInfo * FindSQLClassInfo(const char *clname, Int_t version)
Return (if exists) TSQLClassInfo for specified class name and version.
Definition: TSQLFile.cxx:1774
TSQLResult
Definition: TSQLResult.h:32
TSQLFile::HasTable
Bool_t HasTable(const char *name)
Test if table name exists.
Definition: TSQLFile.cxx:1884
TBufferSQL2
Converts data to SQL statements or read data from SQL tables.
Definition: TBufferSQL2.h:27
TSQLFile::ReadConfigurations
Bool_t ReadConfigurations()
read table configurations as special table
Definition: TSQLFile.cxx:1055
TSQLFile::ReadFree
void ReadFree() final
Read the FREE linked list.
Definition: TSQLFile.h:239
TSQLFile::GetQuerisCounter
Int_t GetQuerisCounter() const
Definition: TSQLFile.h:195
TSQLFile::IsOpen
Bool_t IsOpen() const final
return kTRUE if file is opened and can be accessed
Definition: TSQLFile.cxx:711
TSQLFile::SQLMaxIdentifierLength
Int_t SQLMaxIdentifierLength()
returns maximum allowed length of identifiers
Definition: TSQLFile.cxx:1598
TSQLFile::SQLApplyCommands
Bool_t SQLApplyCommands(TObjArray *cmds)
supplies set of commands to server Commands is stored as array of TObjString
Definition: TSQLFile.cxx:1474
TSQLFile::SQLCanStatement
Bool_t SQLCanStatement()
Test if DB support statement and number of open statements is not exceeded.
Definition: TSQLFile.cxx:1426
TSQLFile::SQLIdentifierQuote
const char * SQLIdentifierQuote() const
Definition: TSQLFile.h:136
TSQLFile::TSqlRawBuffer
friend class TSqlRawBuffer
Definition: TSQLFile.h:37
TSQLFile::GetUseTransactions
Int_t GetUseTransactions() const
Definition: TSQLFile.h:192
TSQLFile::SQLMaximumValue
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:1514
TSQLFile::InitSqlDatabase
void InitSqlDatabase(Bool_t create)
initialize sql database and correspondent structures identical to TFile::Init() function
Definition: TSQLFile.cxx:999
TSQLFile::IsODBC
Bool_t IsODBC() const
checks, if ODBC driver used for database connection
Definition: TSQLFile.cxx:488
TSQLFile::ProduceClassSelectQuery
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:1238
TSQLFile::fBasicTypes
const char ** fBasicTypes
! pointer on list of basic types specific for currently connected SQL server
Definition: TSQLFile.h:160
TSQLFile::SetUseIndexes
void SetUseIndexes(Int_t use_type=kIndexesBasic)
Specify usage of indexes for data tables.
Definition: TSQLFile.cxx:616
TSQLFile::DeleteKeyFromDB
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:1613
TSQLFile::FindSQLKey
TKeySQL * FindSQLKey(TDirectory *dir, Long64_t keyid)
Search for TKeySQL object with specified keyid.
Definition: TSQLFile.cxx:1672
TSQLFile::fOtherTypes
const char ** fOtherTypes
! pointer on list of other SQL types like TEXT or blob
Definition: TSQLFile.h:161
TSQLFile::SQLIntType
const char * SQLIntType() const
return SQL integer type
Definition: TSQLFile.cxx:2575
TSQLFile::SetEND
void SetEND(Long64_t) final
Definition: TSQLFile.h:244
TSQLFile::CreateKey
TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize) final
create SQL key, which will store object in data base
Definition: TSQLFile.cxx:767
TSQLFile::SysSync
Int_t SysSync(Int_t) final
Interface to system fsync. All arguments like in POSIX fsync().
Definition: TSQLFile.h:50
TSQLFile::IsReadAccess
Bool_t IsReadAccess()
dummy, in future should check about read access to database
Definition: TSQLFile.cxx:1373
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TSQLRow
Definition: TSQLRow.h:30
TSQLFile::DirWriteKeys
void DirWriteKeys(TDirectory *) final
Write directory keys list to database.
Definition: TSQLFile.cxx:2612
TSQLFile::AddIdEntry
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:2019
TSQLFile::SQLRollback
Bool_t SQLRollback()
Rollback all SQL operations, done after start transaction.
Definition: TSQLFile.cxx:1590
TSQLFile::GetUseIndexes
Int_t GetUseIndexes() const
Definition: TSQLFile.h:194
Long_t
long Long_t
Definition: RtypesCore.h:54
TSQLFile::StopLogFile
void StopLogFile()
close logging file
Definition: TSQLFile.cxx:457
TSQLFile::ReadSpecialObject
TObject * ReadSpecialObject(Long64_t keyid, TObject *obj=0)
Read data of special kind of objects.
Definition: TSQLFile.cxx:852
TSQLFile::SQLDefaultTableType
const char * SQLDefaultTableType() const
Definition: TSQLFile.h:144
TSQLFile::fStmtCounter
Int_t fStmtCounter
! count numbers of active statements
Definition: TSQLFile.h:168
TSQLFile::IsWriteAccess
Bool_t IsWriteAccess()
Checkis, if lock is free in configuration tables.
Definition: TSQLFile.cxx:1327
TSQLFile::StartTransaction
Bool_t StartTransaction()
Start user transaction.
Definition: TSQLFile.cxx:566
TSQLFile::fIdsTableExists
Bool_t fIdsTableExists
! indicate if IdsTable exists
Definition: TSQLFile.h:167
TSQLFile::SQLSmallTextTypeLimit
Int_t SQLSmallTextTypeLimit() const
Definition: TSQLFile.h:133
TSQLFile::SQLObjectsInfo
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:2372
TSQLFile::UpdateKeyData
Bool_t UpdateKeyData(TKeySQL *key)
Updates (overwrites) key data in KeysTable.
Definition: TSQLFile.cxx:1723
TSQLFile::StartLogFile
void StartLogFile(const char *fname)
start logging of all SQL statements in specified file
Definition: TSQLFile.cxx:448
TSQLFile::SQLObjectInfo
Bool_t SQLObjectInfo(Long64_t objid, TString &clname, Version_t &version)
Read from objects table data for specified objectid.
Definition: TSQLFile.cxx:2345
TSQLFile::SQLDatetimeType
const char * SQLDatetimeType() const
Definition: TSQLFile.h:135
TSQLFile::GetSize
Long64_t GetSize() const final
Returns the current file size.
Definition: TSQLFile.h:224
TSQLFile::ETransactionKinds
ETransactionKinds
Definition: TSQLFile.h:175
TSQLFile::fTablesType
TString fTablesType
! type, used in CREATE TABLE statements
Definition: TSQLFile.h:154
TSQLFile::GetStreamerInfoListImpl
InfoListRet GetStreamerInfoListImpl(bool) final
Read back streamer infos from database List of streamer infos is always stored with key:id 0,...
Definition: TSQLFile.cxx:883
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
TSQLFile::TSqlRegistry
friend class TSqlRegistry
Definition: TSQLFile.h:36
TSQLFile::EIndexesKinds
EIndexesKinds
Definition: TSQLFile.h:177
unsigned int
TSQLFile::FillBuffer
void FillBuffer(char *&) final
Encode file output buffer.
Definition: TSQLFile.h:211
TSQLFile::CodeLongString
TString CodeLongString(Long64_t objid, Int_t strid)
Produces id which will be placed in column instead of string itself.
Definition: TSQLFile.cxx:2215
TSQLFile::MakeSelectQuery
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:1216
TSQLFile::VerifyLongStringTable
Bool_t VerifyLongStringTable()
Checks that table for big strings is exists If not, will be created.
Definition: TSQLFile.cxx:2188
TSQLFile::WriteKeyData
Bool_t WriteKeyData(TKeySQL *key)
Add entry into keys table.
Definition: TSQLFile.cxx:1692
TSQLFile::GetBlobClassData
TSQLResult * GetBlobClassData(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request results for specified objid from streamer classtable.
Definition: TSQLFile.cxx:2465
TSQLFile::Flush
void Flush() final
Synchronize a file's in-memory and on-disk states.
Definition: TSQLFile.h:212
TSQLFile::Recover
Int_t Recover() final
Attempt to recover file if not correctly closed.
Definition: TSQLFile.h:240
TSQLFile::SysWrite
Int_t SysWrite(Int_t, const void *, Int_t) final
Interface to system write. All arguments like in POSIX write().
Definition: TSQLFile.h:47
TKey
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition: TKey.h:28
TSQLFile::GetNfree
Int_t GetNfree() const final
Definition: TSQLFile.h:219
TSQLFile::MakeFree
void MakeFree(Long64_t, Long64_t) final
Mark unused bytes on the file.
Definition: TSQLFile.h:231
TSQLFile::SQLTestTable
Bool_t SQLTestTable(const char *tablename)
Test, if table of specified name exists.
Definition: TSQLFile.cxx:1494
TSQLFile::SysStat
Int_t SysStat(Int_t, Long_t *, Long64_t *, Long_t *, Long_t *) final
Return file stat information.
Definition: TSQLFile.h:49
TSQLFile::ELockingKinds
ELockingKinds
Definition: TSQLFile.h:41
TSQLFile::WriteSpecialObject
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:830
TSQLFile::SQLCompatibleType
const char * SQLCompatibleType(Int_t typ) const
Returns sql type name which is most closer to ROOT basic type.
Definition: TSQLFile.cxx:2567
TSQLFile::Rollback
Bool_t Rollback()
Rollback all operations, done after StartTransaction() call.
Definition: TSQLFile.cxx:594
TSQLFile::DrawMap
void DrawMap(const char *="*", Option_t *="") final
Draw map of objects in this file.
Definition: TSQLFile.h:210
TSQLFile::SkipArrayLimit
void SkipArrayLimit()
Definition: TSQLFile.h:188
TSQLFile::Map
void Map(Option_t *) final
List the contents of a file sequentially.
Definition: TSQLFile.h:233
TSQLFile::fUserName
TString fUserName
! user name, used to access objects from database
Definition: TSQLFile.h:163
TSQLFile::ReOpen
Int_t ReOpen(Option_t *mode) final
Reopen a file with a different access mode, like from READ to See TFile::Open() for details.
Definition: TSQLFile.cxx:720
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TSQLFile::GetLocking
Int_t GetLocking()
Return current locking mode for that file.
Definition: TSQLFile.cxx:1349
TSQLFile::SQLCommit
Bool_t SQLCommit()
Commit SQL transaction.
Definition: TSQLFile.cxx:1582
TSQLFile::fUseSuffixes
Bool_t fUseSuffixes
! use suffixes in column names like fValue:Int_t or fObject:pointer
Definition: TSQLFile.h:150
TSQLFile::Sizeof
Int_t Sizeof() const final
Return the size in bytes of the file header.
Definition: TSQLFile.h:245
TSQLStatement
Definition: TSQLStatement.h:21
TSQLFile::fCanChangeConfig
Bool_t fCanChangeConfig
! variable indicates can be basic configuration changed or not
Definition: TSQLFile.h:153
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TSQLFile::fSQLIOversion
Int_t fSQLIOversion
! version of SQL I/O which is stored in configurations
Definition: TSQLFile.h:151
TSQLFile::WriteStreamerInfo
void WriteStreamerInfo() final
Store all TVirtualStreamerInfo, used in file, in sql database.
Definition: TSQLFile.cxx:791
name
char name[80]
Definition: TGX11.cxx:110
TSQLFile::kIndexesClass
@ kIndexesClass
Definition: TSQLFile.h:177
TSQLFile::SysSeek
Long64_t SysSeek(Int_t, Long64_t, Int_t) final
Interface to system lseek.
Definition: TSQLFile.h:48
TSQLFile::SetTablesType
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:529
TSQLFile::TSQLFile
TSQLFile(const TSQLFile &)=delete
TSQLFile::VerifyObjectTable
Long64_t VerifyObjectTable()
Checks that objects table is exists If not, table will be created Returns maximum value for existing ...
Definition: TSQLFile.cxx:2306
TSQLFile::kIndexesNone
@ kIndexesNone
Definition: TSQLFile.h:177
TDirectory
Describe directory structure in memory.
Definition: TDirectory.h:40
TSQLFile::SetUseSuffixes
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:499
TSQLFile::SQLNameSeparator
const char * SQLNameSeparator() const
Definition: TSQLFile.h:142
TSQLFile::kTransactionsUser
@ kTransactionsUser
Definition: TSQLFile.h:175
TSQLFile::SysRead
Int_t SysRead(Int_t, void *, Int_t) final
Interface to system read. All arguments like in POSIX read().
Definition: TSQLFile.h:46
TSQLFile::WriteBuffer
Bool_t WriteBuffer(const char *, Int_t) final
Write a buffer to the file.
Definition: TSQLFile.h:247
TSQLFile::StreamKeysForDirectory
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:921
TSQLFile::IncrementModifyCounter
void IncrementModifyCounter()
Update value of modify counter in config table Modify counter used to indicate that something was cha...
Definition: TSQLFile.cxx:1189
TSQLFile::GetSeekFree
Long64_t GetSeekFree() const final
Definition: TSQLFile.h:222
TSQLFile::SQLQuery
TSQLResult * SQLQuery(const char *cmd, Int_t flag=0, Bool_t *res=0)
Submits query to SQL server.
Definition: TSQLFile.cxx:1390
TSQLFile::CreateBasicTables
void CreateBasicTables()
Creates initial tables in database This is table with configurations and table with keys Function cal...
Definition: TSQLFile.cxx:1117
type
int type
Definition: TGX11.cxx:121
TSQLFile::fLogFile
std::ofstream * fLogFile
! log file with SQL statements
Definition: TSQLFile.h:165
TSQLFile::SQLObjectIdColumn
const char * SQLObjectIdColumn() const
Definition: TSQLFile.h:139
TSQLFile::CreateRawTable
Bool_t CreateRawTable(TSQLClassInfo *sqlinfo)
Create the raw table.
Definition: TSQLFile.cxx:2142
TSQLFile::SetUseTransactions
void SetUseTransactions(Int_t mode=kTransactionsAuto)
Defines usage of transactions statements for writing objects data to database.
Definition: TSQLFile.cxx:549
TSQLFile::IsTablesExists
Bool_t IsTablesExists()
Checks if main keys table is existing.
Definition: TSQLFile.cxx:1319
TSQLFile::SQLDeleteAllTables
void SQLDeleteAllTables()
Delete all tables in database.
Definition: TSQLFile.cxx:1550
TSQLFile::CreateClassTable
Bool_t CreateClassTable(TSQLClassInfo *sqlinfo, TObjArray *colinfos)
Create normal class table if required.
Definition: TSQLFile.cxx:2060
TStreamerElement
Definition: TStreamerElement.h:33
TSQLFile::DefineTableName
TString DefineTableName(const char *clname, Int_t version, Bool_t rawtable)
Proposes table name for class.
Definition: TSQLFile.cxx:1835
TSQLServer
Definition: TSQLServer.h:41
TSQLFile::~TSQLFile
virtual ~TSQLFile()
destructor of TSQLFile object
Definition: TSQLFile.cxx:690
TSQLFile::SaveToDatabase
void SaveToDatabase()
save data which is not yet in Database Typically this is streamerinfos structures or
Definition: TSQLFile.cxx:907
TSQLFile::fSQLClassInfos
TList * fSQLClassInfos
! list of SQL class infos
Definition: TSQLFile.h:148
TSQLTableData
Definition: TSQLStructure.h:59
TSQLFile::SQLRawIdColumn
const char * SQLRawIdColumn() const
Definition: TSQLFile.h:140
TSQLFile::fUseIndexes
Int_t fUseIndexes
! use indexes for tables: 0 - off, 1 - only for basic tables, 2 + normal class tables,...
Definition: TSQLFile.h:156
TSQLFile::StoreObjectInTables
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:2512
TSQLFile::GetTablesType
const char * GetTablesType() const
Definition: TSQLFile.h:190
TList
A doubly linked list.
Definition: TList.h:44
TSQLFile
Access an SQL db via the TFile interface.
Definition: TSQLFile.h:30
int
TSQLFile::SQLStatement
TSQLStatement * SQLStatement(const char *cmd, Int_t bufsize=1000)
Produces SQL statement for currently conected DB server.
Definition: TSQLFile.cxx:1440
TSQLFile::kLockFree
@ kLockFree
Definition: TSQLFile.h:41