180 TSQLFile(
const char *dbname,
Option_t *
option =
"read",
const char *user =
"user",
const char *pass =
"pass");
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Converts data to SQL statements or read data from SQL tables.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Describe directory structure in memory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
TKeySQL represents meta-information about object, which was written to SQL database.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Mother of all ROOT objects.
Contains information about tables specific to one class and version.
Access an SQL db via the TFile interface.
Int_t Sizeof() const final
Return the size in bytes of the file header.
Bool_t CreateClassTable(TSQLClassInfo *sqlinfo, TObjArray *colinfos)
Create normal class table if required.
TString MakeSelectQuery(TClass *cl)
Produce SELECT statement which can be used to get all data of class cl in one SELECT statement.
const char * SQLIdentifierQuote() const
void DrawMap(const char *="*", Option_t *="") final
Draw map of objects in this file.
Int_t DirReadKeys(TDirectory *) final
Read directory list of keys from database.
Int_t SysWrite(Int_t, const void *, Int_t) final
Interface to system write. All arguments like in POSIX write().
Long64_t VerifyObjectTable()
Checks that objects table is exists If not, table will be created Returns maximum value for existing ...
TSQLResult * GetNormalClassData(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request result for specified objid from normal classtable.
Int_t GetIOVersion() const
TSQLFile()
default TSQLFile constructor
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...
void StartLogFile(const char *fname)
start logging of all SQL statements in specified file
Bool_t fUseSuffixes
! use suffixes in column names like fValue:Int_t or fObject:pointer
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.
TKey * CreateKey(TDirectory *mother, const TObject *obj, const char *name, Int_t bufsize) final
create SQL key, which will store object in data base
Bool_t ReadConfigurations()
read table configurations as special table
Int_t SysSync(Int_t) final
Interface to system fsync. All arguments like in POSIX fsync().
TSQLFile(const TSQLFile &)=delete
const char * GetTablesType() const
Int_t IsLongStringCode(Long64_t objid, const char *value)
Checks if this is long string code returns 0, if not or string id.
void CreateBasicTables()
Creates initial tables in database This is table with configurations and table with keys Function cal...
Int_t GetUseTransactions() const
void WriteHeader() final
Write file info like configurations, title, UUID and other.
TSQLClassInfo * FindSQLClassInfo(const char *clname, Int_t version)
Return (if exists) TSQLClassInfo for specified class name and version.
TSQLResult * SQLQuery(const char *cmd, Int_t flag=0, Bool_t *res=nullptr)
Submits query to SQL server.
Long64_t GetEND() const final
const char * SQLDatetimeType() const
void ReadSQLClassInfos()
Read all class infos from IdsTable.
Bool_t Commit()
Commit transaction, started by StartTransaction() call.
void IncrementModifyCounter()
Update value of modify counter in config table Modify counter used to indicate that something was cha...
Int_t fArrayLimit
! limit for array size. when array bigger, its content converted to raw format
void operator=(const TSQLFile &)=delete
void SetLocking(Int_t mode)
Set locking mode for current database.
Int_t ReOpen(Option_t *mode) final
Reopen a file with a different access mode, like from READ to See TFile::Open() for details.
Int_t GetNbytesFree() const final
Bool_t SQLRollback()
Rollback all SQL operations, done after start transaction.
TObjArray * SQLObjectsInfo(Long64_t keyid)
Produce array of TSQLObjectInfo objects for all objects, belong to that key Array should be deleted b...
Bool_t GetUseSuffixes() const
Bool_t SQLCanStatement()
Test if DB support statement and number of open statements is not exceeded.
Bool_t CreateRawTable(TSQLClassInfo *sqlinfo)
Create the raw table.
Long64_t StoreObjectInTables(Long64_t keyid, const void *obj, const TClass *cl)
Store object in database. Return stored object id or -1 if error.
void InitSqlDatabase(Bool_t create)
initialize sql database and correspondent structures identical to TFile::Init() function
const char * SQLStrIdColumn() const
Bool_t IsOpen() const final
return kTRUE if file is opened and can be accessed
Bool_t SQLObjectInfo(Long64_t objid, TString &clname, Version_t &version)
Read from objects table data for specified objectid.
void MakeFree(Long64_t, Long64_t) final
Mark unused bytes on the file.
void MakeProject(const char *, const char *="*", Option_t *="new") final
Generate source code necessary to access the objects stored in the file.
Int_t GetNfree() const final
Int_t fQuerisCounter
! how many query was applied
const char * SQLValueQuote() const
const char * SQLBigTextType() const
Int_t GetLocking()
Return current locking mode for that file.
Bool_t HasTable(const char *name)
Test if table name exists.
TKeySQL * FindSQLKey(TDirectory *dir, Long64_t keyid)
Search for TKeySQL object with specified keyid.
Long64_t SysSeek(Int_t, Long64_t, Int_t) final
Interface to system lseek.
Bool_t ReadBuffer(char *, Long64_t, Int_t) final
Read a buffer from the file at the offset 'pos' in the file.
const char * SQLDefaultTableType() const
Bool_t Rollback()
Rollback all operations, done after StartTransaction() call.
Bool_t IsWriteAccess()
Checkis, if lock is free in configuration tables.
void ResetErrno() const final
Method resetting the errno.
Bool_t IsMySQL() const
checks, if MySQL database
InfoListRet GetStreamerInfoListImpl(bool) final
Read back streamer infos from database List of streamer infos is always stored with key:id 0,...
Bool_t ReadBuffer(char *, Int_t) final
Read a buffer from the file.
void SQLDeleteAllTables()
Delete all tables in database.
Bool_t IsOracle() const
checks, if Oracle database
Int_t SysClose(Int_t) final
Interface to system close. All arguments like in POSIX close().
Int_t GetErrno() const final
Method returning errno.
void Seek(Long64_t, ERelativeTo=kBeg) final
Seek to a specific position in the file. Pos it either kBeg, kCur or kEnd.
const char * SQLNameSeparator() const
void Paint(Option_t *="") final
Paint all objects in the file.
void SetTablesType(const char *table_type)
Defines tables type, which is used in CREATE TABLE statements Now is only used for MySQL database,...
Int_t SQLSmallTextTypeLimit() const
const char * SQLKeyIdColumn() const
Long64_t GetSize() const final
Returns the current file size.
Bool_t WriteKeyData(TKeySQL *key)
Add entry into keys table.
void SetUseTransactions(Int_t mode=kTransactionsAuto)
Defines usage of transactions statements for writing objects data to database.
Int_t fStmtCounter
! count numbers of active statements
Bool_t fCanChangeConfig
! variable indicates can be basic configuration changed or not
TString CodeLongString(Long64_t objid, Int_t strid)
Produces id which will be placed in column instead of string itself.
void Map(Option_t *) final
List the contents of a file sequentially.
const char * SQLObjectIdColumn() const
Int_t Recover() final
Attempt to recover file if not correctly closed.
const char ** fOtherTypes
! pointer on list of other SQL types like TEXT or blob
Bool_t WriteBuffer(const char *, Int_t) final
Write a buffer to the file.
Bool_t fIdsTableExists
! indicate if IdsTable exists
TSQLStatement * GetBlobClassDataStmt(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request results for specified objid from streamer classtable Data returned in form of s...
TSQLResult * GetBlobClassData(Long64_t objid, TSQLClassInfo *sqlinfo)
Method return request results for specified objid from streamer classtable.
TObject * ReadSpecialObject(Long64_t keyid, TObject *obj=nullptr)
Read data of special kind of objects.
void DeleteKeyFromDB(Long64_t keyid)
Remove key with specified id from keys table also removes all objects data, related to this table.
void Flush() final
Synchronize a file's in-memory and on-disk states.
Long64_t GetSeekFree() const final
void Close(Option_t *option="") final
Close a SQL file For more comments see TFile::Close() function.
Bool_t SQLTestTable(const char *tablename)
Test, if table of specified name exists.
const char * SQLIntType() const
return SQL integer type
TSQLStatement * SQLStatement(const char *cmd, Int_t bufsize=1000)
Produces SQL statement for currently conected DB server.
void SQLDeleteStatement(TSQLStatement *stmt)
delete statement and decrease counter
TList * fSQLClassInfos
! list of SQL class infos
void FillBuffer(char *&) final
Encode file output buffer.
void DirWriteKeys(TDirectory *) final
Write directory keys list to database.
std::ofstream * fLogFile
! log file with SQL statements
Long64_t DefineNextKeyId()
Returns next possible key identifier.
Int_t SysStat(Int_t, Long_t *, Long64_t *, Long_t *, Long_t *) final
Return file stat information.
TSQLResult * GetNormalClassDataAll(Long64_t minobjid, Long64_t maxobjid, TSQLClassInfo *sqlinfo)
Return data for several objects from the range from normal class table.
Int_t SysRead(Int_t, void *, Int_t) final
Interface to system read. All arguments like in POSIX read().
Int_t GetUseIndexes() const
Int_t GetNbytesInfo() const final
void ReadFree() final
Read the FREE linked list.
void WriteStreamerInfo() final
Store all TVirtualStreamerInfo, used in file, in sql database.
void SaveToDatabase()
save data which is not yet in Database Typically this is streamerinfos structures or
Bool_t SQLApplyCommands(TObjArray *cmds)
supplies set of commands to server Commands is stored as array of TObjString
Int_t GetQuerisCounter() const
const char ** fBasicTypes
! pointer on list of basic types specific for currently connected SQL server
Long64_t DirCreateEntry(TDirectory *) final
Create entry for directory in database.
Bool_t IsReadAccess()
dummy, in future should check about read access to database
Int_t SQLMaxIdentifierLength()
returns maximum allowed length of identifiers
Bool_t GetLongString(Long64_t objid, Int_t strid, TString &value)
Returns value of string, extracted from special table, where long strings are stored.
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...
void WriteFree() final
Write FREE linked list on the file.
Bool_t SQLCommit()
Commit SQL transaction.
const char * SQLRawIdColumn() const
Bool_t UpdateKeyData(TKeySQL *key)
Updates (overwrites) key data in KeysTable.
TString fUserName
! user name, used to access objects from database
Int_t fUseIndexes
! use indexes for tables: 0 - off, 1 - only for basic tables, 2 + normal class tables,...
const char * GetDataBaseName() const
Return name of data base on the host For Oracle always return 0.
void SetUseSuffixes(Bool_t on=kTRUE)
enable/disable uasge of suffixes in columns names can be changed before first object is saved into fi...
void SetEND(Long64_t) final
Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) final
Write memory objects to this file.
Int_t fUseTransactions
! use transaction statements for writing data into the tables
Int_t StreamKeysForDirectory(TDirectory *dir, Bool_t doupdate, Long64_t specialkeyid=-1, TKeySQL **specialkey=nullptr)
read keys for specified directory (when update == kFALSE) or update value for modified keys when upda...
void Print(Option_t *="") const final
Print all objects in the file.
Int_t SysOpen(const char *, Int_t, UInt_t) final
Interface to system open. All arguments like in POSIX open().
TString DefineTableName(const char *clname, Int_t version, Bool_t rawtable)
Proposes table name for class.
Long64_t GetSeekInfo() const final
Bool_t IsTablesExists()
Checks if main keys table is existing.
Int_t Write(const char *=nullptr, Int_t=0, Int_t=0) const final
One can not save a const TDirectory object.
void StopLogFile()
close logging file
void SetArrayLimit(Int_t limit=20)
Defines maximum number of columns for array representation If array size bigger than limit,...
Long64_t SQLMaximumValue(const char *tablename, const char *columnname)
Returns maximum value, found in specified columnname of table tablename Column type should be numeric...
TSQLServer * fSQL
! interface to SQL database
TString fTablesType
! type, used in CREATE TABLE statements
TSQLClassInfo * RequestSQLClassInfo(const char *clname, Int_t version)
Search in database tables for specified class and return TSQLClassInfo object.
Int_t GetArrayLimit() const
Bool_t IsODBC() const
checks, if ODBC driver used for database connection
void DirWriteHeader(TDirectory *) final
Update dir header in the file.
Int_t fModifyCounter
! indicates how many changes was done with database tables
~TSQLFile() override
destructor of TSQLFile object
const char * SQLDirIdColumn() const
Int_t fSQLIOversion
! version of SQL I/O which is stored in configurations
Bool_t StartTransaction()
Start user transaction.
const char * SQLSmallTextType() const
void SetUseIndexes(Int_t use_type=kIndexesBasic)
Specify usage of indexes for data tables.
const char * SQLCompatibleType(Int_t typ) const
Returns sql type name which is most closer to ROOT basic type.
Bool_t VerifyLongStringTable()
Checks that table for big strings is exists If not, will be created.
Bool_t SQLStartTransaction()
Start SQL transaction.
This is hierarchical structure, which is created when data is written by TBufferSQL2.
const char * Data() const
Abstract Interface class describing Streamer information for one class.