12#ifndef ROOT_TSQLStructure
13#define ROOT_TSQLStructure
133 void SetValue(
const char *value,
const char *tname = 0);
153 void AddValue(
const char *value,
const char *tname = 0);
243extern const char *
Array;
244extern const char *
Bool;
245extern const char *
Char;
246extern const char *
Short;
247extern const char *
Int;
248extern const char *
Long;
250extern const char *
Float;
252extern const char *
UChar;
254extern const char *
UInt;
255extern const char *
ULong;
258extern const char *
True;
259extern const char *
False;
#define ClassDef(name, id)
Converts data to SQL statements or read data from SQL tables.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Mother of all ROOT objects.
Contains information about tables specific to one class and version.
TString fName
! name of the table column
const char * GetName() const final
Returns name of object.
ClassDefOverride(TSQLColumnData, 1)
TString fValue
! value of the table column
const char * GetType() const
TSQLColumnData(const char *name, const char *sqltype, const char *value, Bool_t numeric)
normal constructor of TSQLColumnData class specifies name, type and value for one column
const char * GetValue() const
Bool_t fNumeric
! for numeric quotes (double quotes) are not required
TString fType
! type of the table column
Access an SQL db via the TFile interface.
TSQLObjectData is used in TBufferSQL2 class in reading procedure.
This is hierarchical structure, which is created when data is written by TBufferSQL2.
Bool_t RecognizeTString(const char *&value)
prove that structure contains TString data
TSQLStructure * GetParent() const
Int_t LocateElementColumn(TSQLFile *f, TBufferSQL2 *buf, TSQLObjectData *data)
find column in TSQLObjectData object, which correspond to current element
TClass * GetObjectClass() const
return object class if type kSqlObject
virtual void Print(Option_t *option="") const
print content of complete structure
Bool_t TryConvertObjectArray(TSqlRegistry *reg, TSqlRawBuffer *blobs)
tries to write array of objects as list of object references in streamer table, while objects itself ...
static void AddStrBrackets(TString &s, const char *quote)
adds quotes around string value and replaces some special symbols
void Add(TSQLStructure *child)
Add child structure.
void AddVersion(const TClass *cl, Int_t version=-100)
add child as version
void SetVersion(const TClass *cl, Int_t version=-100)
set structure type as kSqlVersion
void SetObjectPointer(Long64_t ptrid)
set structure type as kSqlPointer
void SetValue(const char *value, const char *tname=0)
set structure type as kSqlValue
void SetArray(Int_t sz=-1)
Set structure as array element.
static Bool_t IsNumericType(Int_t typ)
defines if value is numeric and not requires quotes when writing
Int_t GetElementNumber() const
returns number of TStremerElement in TStreamerInfo
TSQLObjectData * GetObjectData(Bool_t search=false)
searches for objects data
TStreamerInfo * GetStreamerInfo() const
return TStreamerInfo* if type is kSqlStreamerInfo
void PerformConversion(TSqlRegistry *reg, TSqlRawBuffer *blobs, const char *topname, Bool_t useblob=kFALSE)
perform conversion of structure to sql statements first tries convert it to normal form if fails,...
Bool_t StoreTObject(TSqlRegistry *reg)
store data of TObject in special table workaround custom TObject streamer
TSQLStructure * GetChild(Int_t n) const
return child structure of index n
Bool_t GetClassInfo(TClass *&cl, Version_t &version)
provides class info if structure kSqlStreamerInfo or kSqlCustomClass
void SetCustomClass(const TClass *cl, Version_t version)
set structure type as kSqlCustomClass
const char * GetValue() const
returns value for different structure kinds has different sense For kSqlVersion it version,...
static Bool_t UnpackTString(TSQLFile *f, TBufferSQL2 *buf, TSQLObjectData *data, Long64_t objid, Int_t clversion)
Unpack TString data in form, accepted by custom TString streamer.
static Int_t DefineElementColumnType(TStreamerElement *elem, TSQLFile *f)
defines which kind of column can be assigned for this element Possible cases kColSimple - basic data ...
Int_t GetRepeatCounter() const
Long64_t FindMaxObjectId()
define maximum reference id, used for objects
Bool_t StoreObjectInNormalForm(TSqlRegistry *reg)
this function verify object child elements and calls transformation to class table
void SetStreamerInfo(const TStreamerInfo *info)
set structure type as kSqlStreamerInfo
void AddObjectData(TSQLObjectData *objdata)
add element with pointer to object data
void SetArrayIndex(Int_t indx, Int_t cnt=1)
set array index for this structure
Bool_t StoreClassInNormalForm(TSqlRegistry *reg)
produces data for complete class table where not possible, raw data for some elements are created
static TString MakeArrayIndex(TStreamerElement *elem, Int_t n)
produce string with complete index like [1][2][0]
Version_t GetCustomClassVersion() const
return custom class version if structures is kSqlCustomClass
static Bool_t UnpackTObject(TSQLFile *f, TBufferSQL2 *buf, TSQLObjectData *data, Long64_t objid, Int_t clversion)
Unpack TObject data in form, accepted by custom TObject streamer.
Bool_t StoreObject(TSqlRegistry *reg, Long64_t objid, TClass *cl, Bool_t registerobj=kTRUE)
convert object data to sql statements if normal (column-wise) representation is not possible,...
void ChangeValueOnly(const char *value)
change value of this structure used as "workaround" to keep object id in kSqlElement node
Bool_t ConvertToTables(TSQLFile *f, Long64_t keyid, TObjArray *cmds)
Convert structure to sql statements This function is called immidiately after TBufferSQL2 produces th...
void SetCustomElement(TStreamerElement *elem)
set structure type as kSqlCustomElement
const char * GetValueType() const
return value type if structure is kSqlValue
static TString DefineElementColumnName(TStreamerElement *elem, TSQLFile *f, Int_t indx=0)
returns name of the column in class table for that element
Int_t GetArrayIndex() const
void SetObjectData(TSQLObjectData *objdata)
set element to be used for object data
void SetParent(TSQLStructure *p)
void SetObjectRef(Long64_t refid, const TClass *cl)
set structure type as kSqlObject
Long64_t DefineObjectId(Bool_t recursive=kTRUE)
defines current object id, to which this structure belong make life complicated, because some objects...
TStreamerElement * GetElement() const
return TStremerElement* if type is kSqlElement
TClass * GetVersionClass() const
return class for version tag if type is kSqlVersion
void PrintLevel(Int_t level) const
print content of current structure
static const char * GetSimpleTypeName(Int_t typ)
provides name for basic types used as suffix for column name or field suffix in raw table
Bool_t StoreElementInNormalForm(TSqlRegistry *reg, TSQLTableData *columns)
tries to store element data in column
Bool_t CheckNormalClassPair(TSQLStructure *vers, TSQLStructure *info)
check if pair of two element corresponds to start of object, stored in normal form
Int_t NumChilds() const
number of child structures
virtual ~TSQLStructure()
destructor
void AddValue(const char *value, const char *tname=0)
Add child structure as value.
TClass * GetCustomClass() const
return element custom class if structures is kSqlCustomClass
Bool_t StoreTString(TSqlRegistry *reg)
store data of TString in special table it is required when TString stored as pointer and reference to...
void SetClassStreamer(const TClass *cl)
set structure type as kSqlClassStreamer
void SetStreamerElement(const TStreamerElement *elem, Int_t number)
set structure type as kSqlElement
void ChildArrayIndex(Int_t index, Int_t cnt=1)
set array index for last child element if (cnt<=1) return;
void AddColumn(const char *name, Long64_t value)
Add INT column to list of columns.
TString DefineSQLName(const char *fullname)
produce suitable name for column, taking into account length limitation
Bool_t HasSQLName(const char *sqlname)
checks if columns list already has that sql name
const char * GetColumn(Int_t n)
return column value
Bool_t IsNumeric(Int_t n)
identifies if column has numeric value
TObjArray fColumns
! collection of columns
Int_t GetNumColumns()
returns number of columns in provided set
TObjArray * fColInfos
! array with TSQLClassColumnInfo, used later for TSQLClassInfo
TSQLTableData(TSQLFile *f=nullptr, TSQLClassInfo *info=nullptr)
normal constructor
virtual ~TSQLTableData()
destructor
TObjArray * TakeColInfos()
take ownership over colinfos
Describe Streamer information for one class version.
const char * Data() const
static constexpr double s
const char * cfg_UseIndexes
const char * StringsTable
const char * ObjectsTableIndex
const char * ObjectSuffix
const char * KeysTableIndex
Long64_t atol64(const char *value)
const char * TStringValue
const char * cfg_TablesType
const Int_t Ids_FirstObject
const char * ObjectRef_Arr
const Int_t Ids_StreamerInfos
const char * ParentSuffix
const char * cfg_ArrayLimit
const char * TObjectProcessId
const char * PointerSuffix
const char * IdsTableIndex
const char * cfg_UseTransactions
const char * cfg_LockingMode
const char * cfg_UseSufixes
const char * ObjectsTable
const char * cfg_ModifyCounter
const char * TObjectUniqueId
const char * LongStrPrefix