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)_raw$(VERSION) For example: TAxis_ver8 or TList_raw5 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_raw4 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_raw4 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 21) 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() | |
TSQLFile(const char* dbname, Option_t* option = "read", const char* user = "user", const char* pass = "pass") | |
virtual | ~TSQLFile() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | TDirectoryFile::Add(TObject* obj, Bool_t replace = kFALSE) |
static void | TDirectory::AddDirectory(Bool_t add = kTRUE) |
static Bool_t | TDirectory::AddDirectoryStatus() |
virtual void | TDirectoryFile::Append(TObject* obj, Bool_t replace = kFALSE) |
virtual Int_t | TDirectoryFile::AppendKey(TKey* key) |
virtual void | TObject::AppendPad(Option_t* option = "") |
static TFileOpenHandle* | TFile::AsyncOpen(const char* name, Option_t* option = "", const char* ftitle = "", Int_t compress = 1, Int_t netopt = 0) |
virtual void | TDirectoryFile::Browse(TBrowser* b) |
virtual void | TDirectoryFile::Build(TFile* motherFile = 0, TDirectory* motherDir = 0) |
virtual Bool_t | TDirectoryFile::cd(const char* path = 0) |
static Bool_t | TDirectory::Cd(const char* path) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TDirectory::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual TObject* | TDirectoryFile::CloneObject(const TObject* obj, Bool_t autoadd = kTRUE) |
virtual void | Close(Option_t* option = "")MENU |
Bool_t | Commit() |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual void | TFile::Copy(TObject&) const |
virtual Bool_t | TFile::Cp(const char* dst, Bool_t progressbar = kTRUE, UInt_t buffersize = 1000000) |
static Bool_t | TFile::Cp(const char* src, const char* dst, Bool_t progressbar = kTRUE, UInt_t buffersize = 1000000) |
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) |
static TDirectory*& | TDirectory::CurrentDirectory() |
static TFile*& | TFile::CurrentFile() |
static void | TDirectory::DecodeNameCycle(const char* namecycle, char* name, Short_t& cycle, const size_t namesize = 0) |
virtual void | TFile::Delete(const char* namecycle = "") |
virtual void | TDirectory::DeleteAll(Option_t* option = "") |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TFile::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | DrawMap(const char* = "*", Option_t* = "") |
virtual void | TObject::Dump() constMENU |
static void | TDirectory::EncodeNameCycle(char* buffer, const char* name, Short_t cycle) |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | FillBuffer(char*&) |
virtual TKey* | TDirectoryFile::FindKey(const char* keyname) const |
virtual TKey* | TDirectoryFile::FindKeyAny(const char* keyname) const |
virtual TObject* | TDirectory::FindObject(const char* name) const |
virtual TObject* | TDirectory::FindObject(const TObject* obj) const |
virtual TObject* | TDirectoryFile::FindObjectAny(const char* name) const |
virtual TObject* | TDirectoryFile::FindObjectAnyFile(const char* name) const |
virtual void | Flush() |
virtual TObject* | TDirectoryFile::Get(const char* namecycle) |
TArchiveFile* | TFile::GetArchive() const |
Long64_t | TFile::GetArchiveOffset() const |
Int_t | GetArrayLimit() const |
static TFile::EAsyncOpenStatus | TFile::GetAsyncOpenStatus(const char* name) |
static TFile::EAsyncOpenStatus | TFile::GetAsyncOpenStatus(TFileOpenHandle* handle) |
Int_t | TFile::GetBestBuffer() const |
virtual Int_t | TDirectoryFile::GetBufferSize() const |
virtual Long64_t | TFile::GetBytesRead() const |
virtual Long64_t | TFile::GetBytesReadExtra() const |
virtual Int_t | TFile::GetBytesToPrefetch() const |
virtual Long64_t | TFile::GetBytesWritten() const |
static const char* | TFile::GetCacheFileDir() |
TFileCacheRead* | TFile::GetCacheRead(TObject* tree = 0) const |
TFileCacheWrite* | TFile::GetCacheWrite() const |
TArrayC* | TFile::GetClassIndex() const |
Int_t | TFile::GetCompressionAlgorithm() const |
Float_t | TFile::GetCompressionFactor() |
Int_t | TFile::GetCompressionLevel() const |
Int_t | TFile::GetCompressionSettings() const |
const TDatime& | TDirectoryFile::GetCreationDate() const |
const char* | GetDataBaseName() const |
virtual TDirectory* | TDirectoryFile::GetDirectory(const char* apath, Bool_t printError = false, const char* funcname = "GetDirectory") |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual Long64_t | GetEND() const |
virtual const TUrl* | TFile::GetEndpointUrl() const |
static const TUrl* | TFile::GetEndpointUrl(const char* name) |
virtual Int_t | GetErrno() const |
Int_t | TFile::GetFd() const |
virtual TFile* | TDirectoryFile::GetFile() const |
static Long64_t | TFile::GetFileBytesRead() |
static Long64_t | TFile::GetFileBytesWritten() |
static Long64_t | TFile::GetFileCounter() |
static Int_t | TFile::GetFileReadCalls() |
virtual const char* | TObject::GetIconName() const |
virtual TKey* | TDirectoryFile::GetKey(const char* name, Short_t cycle = 9999) const |
virtual TList* | TDirectory::GetList() const |
TList* | TFile::GetListOfFree() const |
virtual TList* | TDirectoryFile::GetListOfKeys() const |
TObjArray* | TFile::GetListOfProcessIDs() const |
const TDatime& | TDirectoryFile::GetModificationDate() const |
virtual TObject* | TDirectory::GetMother() const |
virtual TDirectory* | TDirectory::GetMotherDir() const |
virtual const char* | TNamed::GetName() const |
virtual Int_t | GetNbytesFree() const |
virtual Int_t | GetNbytesInfo() const |
virtual Int_t | TDirectoryFile::GetNbytesKeys() const |
virtual TString | TFile::GetNewUrl() |
virtual Int_t | GetNfree() const |
virtual Int_t | TDirectoryFile::GetNkeys() const |
virtual Int_t | TFile::GetNProcessIDs() const |
void | TDirectory::GetObject(const char* namecycle, void*& ptr) |
virtual void* | TDirectoryFile::GetObjectChecked(const char* namecycle, const char* classname) |
virtual void* | TDirectoryFile::GetObjectChecked(const char* namecycle, const TClass* cl) |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual void* | TDirectoryFile::GetObjectUnchecked(const char* namecycle) |
static Bool_t | TFile::GetOnlyStaged() |
static UInt_t | TFile::GetOpenTimeout() |
virtual Option_t* | TFile::GetOption() const |
virtual const char* | TDirectory::GetPath() const |
virtual const char* | TDirectory::GetPathStatic() const |
Int_t | GetQuerisCounter() const |
static Int_t | TFile::GetReadaheadSize() |
virtual Int_t | TFile::GetReadCalls() const |
Int_t | TFile::GetRecordHeader(char* buf, Long64_t first, Int_t maxbytes, Int_t& nbytes, Int_t& objlen, Int_t& keylen) |
Long64_t | TFile::GetRelOffset() const |
virtual Long64_t | TDirectoryFile::GetSeekDir() const |
virtual Long64_t | GetSeekFree() const |
virtual Long64_t | GetSeekInfo() const |
virtual Long64_t | TDirectoryFile::GetSeekKeys() const |
virtual Long64_t | TDirectoryFile::GetSeekParent() const |
virtual Long64_t | GetSize() const |
const TList* | TFile::GetStreamerInfoCache() |
virtual TList* | GetStreamerInfoList() |
const char* | GetTablesType() const |
virtual const char* | TNamed::GetTitle() const |
static TFile::EFileType | TFile::GetType(const char* name, Option_t* option = "", TString* prefix = 0) |
virtual UInt_t | TObject::GetUniqueID() const |
Int_t | GetUseIndexes() const |
Bool_t | GetUseSuffixes() const |
Int_t | GetUseTransactions() const |
TUUID | TDirectory::GetUUID() const |
Int_t | TFile::GetVersion() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
static void | TFile::IncrementFileCounter() |
virtual void | TFile::IncrementProcessIDs() |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TFile::IsArchive() const |
Bool_t | TFile::IsBinary() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TDirectory::IsFolder() const |
virtual Bool_t | TDirectoryFile::IsModified() const |
Bool_t | IsMySQL() const |
Bool_t | IsODBC() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | IsOpen() const |
Bool_t | IsOracle() const |
Bool_t | TFile::IsRaw() const |
virtual Bool_t | TNamed::IsSortable() const |
virtual Bool_t | TDirectoryFile::IsWritable() const |
Bool_t | TObject::IsZombie() const |
virtual void | TFile::ls(Option_t* option = "") const |
virtual void | MakeFree(Long64_t, Long64_t) |
virtual void | MakeProject(const char*, const char* = "*", Option_t* = "new")MENU |
TString | MakeSelectQuery(TClass* cl) |
virtual void | Map() |
virtual Bool_t | TFile::Matches(const char* name) |
void | TObject::MayNotUse(const char* method) const |
virtual TDirectory* | TDirectoryFile::mkdir(const char* name, const char* title = "") |
virtual Bool_t | TFile::MustFlush() const |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
static TFile* | TFile::Open(TFileOpenHandle* handle) |
static TFile* | TFile::Open(const char* name, Option_t* option = "", const char* ftitle = "", Int_t compress = 1, Int_t netopt = 0) |
virtual TFile* | TDirectoryFile::OpenFile(const char* name, Option_t* option = "", const char* ftitle = "", Int_t compress = 1, Int_t netopt = 0) |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
virtual void | Paint(Option_t* = "") |
virtual void | TObject::Pop() |
virtual void | Print(Option_t* = "") const |
virtual void | TDirectoryFile::Purge(Short_t nkeep = 1) |
virtual void | TDirectory::pwd() const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TDirectoryFile::ReadAll(Option_t* option = "") |
virtual Bool_t | ReadBuffer(char*, Int_t) |
virtual Bool_t | ReadBuffer(char*, Long64_t, Int_t) |
virtual Bool_t | TFile::ReadBufferAsync(Long64_t offs, Int_t len) |
virtual Bool_t | TFile::ReadBuffers(char* buf, Long64_t* pos, Int_t* len, Int_t nbuf) |
virtual void | ReadFree() |
virtual Int_t | TDirectoryFile::ReadKeys(Bool_t forceRead = kTRUE) |
virtual TProcessID* | TFile::ReadProcessID(UShort_t pidf) |
virtual void | TFile::ReadStreamerInfo() |
virtual Int_t | TDirectoryFile::ReadTObject(TObject* obj, const char* keyname) |
virtual Int_t | Recover() |
virtual void | TDirectory::RecursiveRemove(TObject* obj) |
virtual TObject* | TDirectory::Remove(TObject*) |
virtual Int_t | ReOpen(Option_t* mode) |
virtual void | TDirectoryFile::ResetAfterMerge(TFileMergeInfo*) |
void | TObject::ResetBit(UInt_t f) |
virtual void | ResetErrno() const |
virtual void | TDirectoryFile::rmdir(const char* name) |
Bool_t | Rollback() |
virtual void | TDirectoryFile::Save() |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual Int_t | TDirectoryFile::SaveObjectAs(const TObject* obj, const char* filename = "", Option_t* option = "") const |
virtual void | TObject::SavePrimitive(ostream& out, Option_t* option = "") |
virtual void | TDirectoryFile::SaveSelf(Bool_t force = kFALSE) |
virtual void | Seek(Long64_t, TFile::ERelativeTo = kBeg) |
void | SetArrayLimit(Int_t limit = 20) |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | TDirectoryFile::SetBufferSize(Int_t bufsize) |
static Bool_t | TFile::SetCacheFileDir(const char* cacheDir, Bool_t operateDisconnected = kTRUE, Bool_t forceCacheread = kFALSE) |
virtual void | TFile::SetCacheRead(TFileCacheRead* cache, TObject* tree = 0, TFile::ECacheAction action = kDisconnect) |
virtual void | TFile::SetCacheWrite(TFileCacheWrite* cache) |
virtual void | TFile::SetCompressionAlgorithm(Int_t algorithm = 0) |
virtual void | TFile::SetCompressionLevel(Int_t level = 1) |
virtual void | TFile::SetCompressionSettings(Int_t settings = 1) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual void | SetEND(Long64_t) |
static void | TFile::SetFileBytesRead(Long64_t bytes = 0) |
static void | TFile::SetFileBytesWritten(Long64_t bytes = 0) |
static void | TFile::SetFileReadCalls(Int_t readcalls = 0) |
virtual void | TDirectoryFile::SetModified() |
virtual void | TDirectory::SetMother(TObject* mother) |
virtual void | TDirectory::SetName(const char* newname) |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
virtual void | TFile::SetOffset(Long64_t offset, TFile::ERelativeTo pos = kBeg) |
static Bool_t | TFile::SetOnlyStaged(Bool_t onlystaged) |
static UInt_t | TFile::SetOpenTimeout(UInt_t timeout) |
virtual void | TFile::SetOption(Option_t* option = ">") |
static void | TFile::SetReadaheadSize(Int_t bufsize = 256000) |
virtual void | TFile::SetReadCalls(Int_t readcalls = 0) |
static void | TFile::SetReadStreamerInfo(Bool_t readinfo = kTRUE) |
virtual void | TDirectoryFile::SetSeekDir(Long64_t v) |
void | SetTablesType(const char* table_type) |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TDirectoryFile::SetTRefAction(TObject* ref, TObject* parent) |
virtual void | TObject::SetUniqueID(UInt_t uid) |
void | SetUseIndexes(Int_t use_type = kIndexesBasic) |
void | SetUseSuffixes(Bool_t on = kTRUE) |
void | SetUseTransactions(Int_t mode = kTransactionsAuto) |
virtual void | TDirectoryFile::SetWritable(Bool_t writable = kTRUE) |
virtual void | ShowMembers(TMemberInspector&) |
virtual void | TFile::ShowStreamerInfo() |
static Bool_t | TFile::ShrinkCacheFileDir(Long64_t shrinkSize, Long_t cleanupInteval = 0) |
virtual Int_t | Sizeof() const |
void | SkipArrayLimit() |
void | StartLogFile(const char* fname)MENU |
Bool_t | StartTransaction() |
void | StopLogFile()MENU |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
void | TFile::SumBuffer(Int_t bufsize) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | UseCache(Int_t = 10, Int_t = 0) |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
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 | TDirectoryFile::WriteDirHeader() |
virtual void | WriteFree() |
virtual void | WriteHeader() |
virtual void | TDirectoryFile::WriteKeys() |
Int_t | TDirectory::WriteObject(const void* obj, const char* name, Option_t* option = "", Int_t bufsize = 0) |
virtual Int_t | TDirectoryFile::WriteObjectAny(const void* obj, const char* classname, const char* name, Option_t* option = "", Int_t bufsize = 0) |
virtual Int_t | TDirectoryFile::WriteObjectAny(const void* obj, const TClass* cl, const char* name, Option_t* option = "", Int_t bufsize = 0) |
virtual UShort_t | TFile::WriteProcessID(TProcessID* pid) |
virtual void | WriteStreamerInfo() |
virtual Int_t | TDirectoryFile::WriteTObject(const TObject* obj, const char* name = 0, Option_t* option = "", Int_t bufsize = 0) |
enum ELockingKinds { | kLockFree | |
kLockBusy | ||
}; | ||
enum ETransactionKinds { | kTransactionsOff | |
kTransactionsAuto | ||
kTransactionsUser | ||
}; | ||
enum EIndexesKinds { | kIndexesNone | |
kIndexesBasic | ||
kIndexesClass | ||
kIndexesAll | ||
}; | ||
enum TFile::EAsyncOpenStatus { | kAOSNotAsync | |
kAOSFailure | ||
kAOSInProgress | ||
kAOSSuccess | ||
}; | ||
enum TFile::EOpenTimeOut { | kInstantTimeout | |
kEternalTimeout | ||
}; | ||
enum TFile::ECacheAction { | kDisconnect | |
kDoNotDisconnect | ||
}; | ||
enum TFile::EStatusBits { | kRecovered | |
kHasReferences | ||
kDevNull | ||
kWriteError | ||
kBinaryFile | ||
kRedirected | ||
}; | ||
enum TFile::ERelativeTo { | kBeg | |
kCur | ||
kEnd | ||
}; | ||
enum TFile::[unnamed] { | kStartBigFile | |
}; | ||
enum TFile::EFileType { | kDefault | |
kLocal | ||
kNet | ||
kWeb | ||
kFile | ||
kMerge | ||
}; | ||
enum TDirectoryFile::[unnamed] { | kCloseDirectory | |
}; | ||
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
TArchiveFile* | TFile::fArchive | !Archive file from which we read this file |
Long64_t | TFile::fArchiveOffset | !Offset at which file starts in archive |
Int_t | fArrayLimit | ! limit for array size. when array bigger, its content converted to raw format |
TFileOpenHandle* | TFile::fAsyncHandle | !For proper automatic cleanup |
TFile::EAsyncOpenStatus | TFile::fAsyncOpenStatus | !Status of an asynchronous open request |
Long64_t | TFile::fBEGIN | First used byte in file |
const char** | fBasicTypes | ! pointer on list of basic types specific for currently connected SQL server |
Int_t | TDirectoryFile::fBufferSize | Default buffer size to create new TKeys |
Long64_t | TFile::fBytesRead | Number of bytes read from this file |
Long64_t | TFile::fBytesReadExtra | Number of extra bytes (overhead) read by the readahead buffer |
Long64_t | TFile::fBytesWrite | Number of bytes written to this file |
TFileCacheRead* | TFile::fCacheRead | !Pointer to the read cache (if any) |
TMap* | TFile::fCacheReadMap | !Pointer to the read cache (if any) |
TFileCacheWrite* | TFile::fCacheWrite | !Pointer to the write cache (if any) |
Bool_t | fCanChangeConfig | ! variable indicates can be basic configuration changed or not |
TArrayC* | TFile::fClassIndex | !Index of TStreamerInfo classes written to this file |
Int_t | TFile::fCompress | Compression level and algorithm |
TDirectory::TContext* | TDirectory::fContext | !Pointer to a list of TContext object pointing to this TDirectory |
Int_t | TFile::fD | File descriptor |
TDatime | TDirectoryFile::fDatimeC | Date and time when directory is created |
TDatime | TDirectoryFile::fDatimeM | Date and time of last modification |
Long64_t | TFile::fEND | Last used byte in file |
TFile* | TDirectoryFile::fFile | pointer to current file in memory |
TList* | TFile::fFree | Free segments linked list table |
Bool_t | fIdsTableExists | ! indicate if IdsTable exists |
TList* | TFile::fInfoCache | !Cached list of the streamer infos in this file |
Bool_t | TFile::fInitDone | !True if the file has been initialized |
Bool_t | TFile::fIsArchive | !True if this is a pure archive file |
Bool_t | TFile::fIsRootFile | !True is this is a ROOT file, raw file otherwise |
TList* | TDirectoryFile::fKeys | Pointer to keys list in memory |
TList* | TDirectory::fList | List of objects in memory |
ofstream* | fLogFile | ! log file with SQL statements |
Bool_t | TDirectoryFile::fModified | true if directory has been modified |
Int_t | fModifyCounter | ! indicates how many changes was done with database tables |
TObject* | TDirectory::fMother | pointer to mother of the directory |
Bool_t | TFile::fMustFlush | !True if the file buffers must be flushed |
Int_t | TFile::fNProcessIDs | Number of TProcessID written to this file |
TString | TNamed::fName | object identifier |
Int_t | TFile::fNbytesFree | Number of bytes for free segments structure |
Int_t | TFile::fNbytesInfo | Number of bytes for StreamerInfo record |
Int_t | TDirectoryFile::fNbytesKeys | Number of bytes for the keys |
Int_t | TDirectoryFile::fNbytesName | Number of bytes in TNamed at creation time |
Bool_t | TFile::fNoAnchorInName | !True if we don't want to force the anchor to be appended to the file name |
Long64_t | TFile::fOffset | !Seek offset cache |
TList* | TFile::fOpenPhases | !Time info about open phases |
TString | TFile::fOption | File options |
const char** | fOtherTypes | ! pointer on list of other SQL types like TEXT or blob |
TString | TDirectory::fPathBuffer | !Buffer for GetPath() function |
TObjArray* | TFile::fProcessIDs | !Array of pointers to TProcessIDs |
Int_t | fQuerisCounter | ! how many query was applied |
Int_t | TFile::fReadCalls | Number of read calls ( not counting the cache calls ) |
TString | TFile::fRealName | Effective real file name (not original url) |
TSQLServer* | fSQL | ! interface to SQL database |
TList* | fSQLClassInfos | ! list of SQL class infos |
Int_t | fSQLIOversion | ! version of SQL I/O which is stored in configurations |
Long64_t | TDirectoryFile::fSeekDir | Location of directory on file |
Long64_t | TFile::fSeekFree | Location on disk of free segments structure |
Long64_t | TFile::fSeekInfo | Location on disk of StreamerInfo record |
Long64_t | TDirectoryFile::fSeekKeys | Location of Keys record on file |
Long64_t | TDirectoryFile::fSeekParent | Location of parent directory on file |
Int_t | fStmtCounter | ! count numbers of active statements |
Double_t | TFile::fSum2Buffer | Sum of squares of buffer sizes of objects written so far |
Double_t | TFile::fSumBuffer | Sum of buffer sizes of objects written so far |
TString | fTablesType | ! type, used in CREATE TABLE statements |
TString | TNamed::fTitle | object title |
TUUID | TDirectory::fUUID | Unique identifier |
Char_t | TFile::fUnits | Number of bytes for file pointers |
TUrl | TFile::fUrl | !URL of file |
Int_t | fUseIndexes | ! use indexes for tables: 0 - off, 1 - only for basic tables, 2 + normal class tables, 3 - all tables |
Bool_t | fUseSuffixes | ! use suffixes in column names like fValue:Int_t or fObject:pointer |
Int_t | fUseTransactions | ! use transaction statements for writing data into the tables |
TString | fUserName | ! user name, used to access objects from database |
Int_t | TFile::fVersion | File format version |
Bool_t | TDirectoryFile::fWritable | true if directory is writable |
Int_t | TFile::fWritten | Number of objects written so far |
static Bool_t | TDirectory::fgAddDirectory | !flag to add histograms, graphs,etc to the directory |
static TList* | TFile::fgAsyncOpenRequests | List of handles for pending open requests |
static Long64_t | TFile::fgBytesRead | Number of bytes read by all TFile objects |
static Long64_t | TFile::fgBytesWrite | Number of bytes written by all TFile objects |
static TString | TFile::fgCacheFileDir | Directory where to locally stage files |
static Bool_t | TFile::fgCacheFileDisconnected | Indicates, we trust in the files in the cache dir without stat on the cached file |
static Bool_t | TFile::fgCacheFileForce | Indicates, to force all READ to CACHEREAD |
static Long64_t | TFile::fgFileCounter | Counter for all opened files |
static Bool_t | TFile::fgOnlyStaged | Before the file is opened, it is checked, that the file is staged, if not, the open fails |
static UInt_t | TFile::fgOpenTimeout | Timeout for open operations in ms - 0 corresponds to blocking i/o |
static Int_t | TFile::fgReadCalls | Number of bytes read from all TFile objects |
static Bool_t | TFile::fgReadInfo | if true (default) ReadStreamerInfo is called when opening a file |
static Int_t | TFile::fgReadaheadSize | Readahead buffer size |
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
enable/disable uasge of suffixes in columns names can be changed before first object is saved into file
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 21
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.
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
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 successful. 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 .
Commit transaction, started by StartTransaction() call. Only after that call data will be written and visible on database side.
Rollback all operations, done after StartTransaction() call. Database should return to initial state.
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
create SQL key, which will store object in data base
create SQL key, which will store object in data base
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 TDirectoryFile::Get() method
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
save data which is not yet in Database Typically this is streamerinfos structures or
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.
Update value of modify counter in config table Modify counter used to indicate that something was changed in database. It will be used when multiple instances of TSQLFile for the same data base will be connected.
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
used by MakeClassSelectQuery method to add columns from table of class, specified by TVirtualStreamerInfo structure
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
Produces SQL statement for currently conected DB server
supplies set of commands to server Commands is stored as array of TObjString
Returns maximum value, found in specified columnname of table tablename Column type should be numeric
remove key with specified id from keys table also removes all objects data, related to this table
return (if exists) TSQLClassInfo for specified class name and version
return (if exists) TSQLClassInfo for specified class
search in database tables for specified class and return TSQLClassInfo object
proposes table name for class
search in database tables for specified class and return TSQLClassInfo object
Add entry into IdsTable, where all tables names and columns names are listed
Create normal class table if required
produces id which will be placed in column instead of string itself
checks if this is long string code returns 0, if not or string id
returns value of string, extracted from special table, where long strings are stored
Checks that objects table is exists If not, table will be created Returns maximum value for existing objects id
Read from objects table data for specified objectid
Produce array of TSQLObjectInfo objects for all objects, belong to that key Array should be deleted by calling function afterwards
Method return request result for specified objid from normal classtable
return data for several objects from the range from normal class table
Method return request results for specified objid from _streamer_ classtable
Method return request results for specified objid from _streamer_ classtable Data returned in form of statement, where direct access to values are possible
Store object in database. Return stored object id or -1 if error
returns sql type name which is most closer to ROOT basic type typ should be from TVirtualStreamerInfo:: constansts like TVirtualStreamerInfo::kInt
Interface to basic system I/O routines, suppressed
{ return 0; }