library: libSQL #include "TSQLStructure.h" |
TSQLStructure
class description - source file - inheritance tree (.pdf)
protected:
void AddCmd(TObjArray* cmds, const char* name, const char* value, const char* topname = "0", const char* ns = "0")
Bool_t CheckNormalClassPair(TSQLStructure* vers, TSQLStructure* info)
Int_t FindMaxRef()
void PerformConversion(TSqlRegistry* reg, TObjArray* blobs, const char* topname, Bool_t useblob = kFALSE)
Bool_t RecognizeTString(const char*& value)
Bool_t StoreClassInNormalForm(TSqlRegistry* reg)
Bool_t StoreElementInNormalForm(TSqlRegistry* reg, TObjArray* columns)
Bool_t StoreObject(TSqlRegistry* reg, const char* objid, TClass* cl, Bool_t registerobj = kTRUE)
Bool_t StoreObjectInNormalForm(TSqlRegistry* reg)
Bool_t StoreTObject(TSqlRegistry* reg)
Bool_t StoreTString(TSqlRegistry* reg)
Bool_t TryConvertObjectArray(TSqlRegistry* reg, TObjArray* blobs)
public:
TSQLStructure()
virtual ~TSQLStructure()
void Add(TSQLStructure* child)
void AddObjectData(TSQLObjectData* objdata)
void AddValue(const char* value, const char* tname = "0")
void AddVersion(const TClass* cl, Int_t version = -100)
void ChangeValueOnly(const char* value)
void ChildArrayIndex(Int_t index, Int_t cnt = 1)
static TClass* Class()
Bool_t ConvertToTables(TSQLFile* f, Int_t keyid, TObjArray* cmds)
static TString DefineElementColumnName(TStreamerElement* elem, TSQLFile* f, Int_t indx = 0)
static Int_t DefineElementColumnType(TStreamerElement* elem, TSQLFile* f)
Int_t DefineObjectId()
Int_t GetArrayIndex() const
TSQLStructure* GetChild(Int_t n) const
TStreamerElement* GetElement() const
Int_t GetElementNumber() const
TClass* GetObjectClass() const
TSQLObjectData* GetObjectData(Bool_t search = false)
TSQLStructure* GetParent() const
Int_t GetRepeatCounter() const
static const char* GetSimpleTypeName(Int_t typ) const
TStreamerInfo* GetStreamerInfo() const
Int_t GetType() const
const char* GetValue() const
const char* GetValueType() const
TClass* GetVersionClass() const
virtual TClass* IsA() const
Bool_t IsClonesArray()
static Bool_t IsNumericType(Int_t typ)
Int_t LocateElementColumn(TSQLFile* f, TSQLObjectData* data)
static TString MakeArrayIndex(TStreamerElement* elem, Int_t n)
Int_t NumChilds() const
virtual void Print(Option_t* option = "") const
void PrintLevel(Int_t level) const
void SetArray(Int_t sz = -1)
void SetArrayIndex(Int_t indx, Int_t cnt = 1)
void SetClassStreamer(const TClass* cl)
void SetObjectData(TSQLObjectData* objdata)
void SetObjectPointer(Int_t ptrid)
void SetObjectRef(Int_t refid, const TClass* cl)
void SetParent(TSQLStructure* p)
void SetStreamerElement(const TStreamerElement* elem, Int_t number)
void SetStreamerInfo(const TStreamerInfo* info)
void SetType(Int_t typ)
void SetValue(const char* value, const char* tname = "0")
void SetVersion(const TClass* cl, Int_t version = -100)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
static Bool_t UnpackTObject(TSQLFile* f, TSQLObjectData* data, Int_t objid, Int_t clversion)
static Bool_t UnpackTString(TSQLFile* f, TSQLObjectData* data, Int_t objid, Int_t clversion)
protected:
TSQLStructure* fParent !
Int_t fType !
const void* fPointer !
TString fValue !
Int_t fArrayIndex !
Int_t fRepeatCnt !
TObjArray fChilds !
public:
static const TSQLStructure::ESQLTypes kSqlObject
static const TSQLStructure::ESQLTypes kSqlPointer
static const TSQLStructure::ESQLTypes kSqlVersion
static const TSQLStructure::ESQLTypes kSqlStreamerInfo
static const TSQLStructure::ESQLTypes kSqlClassStreamer
static const TSQLStructure::ESQLTypes kSqlElement
static const TSQLStructure::ESQLTypes kSqlValue
static const TSQLStructure::ESQLTypes kSqlArray
static const TSQLStructure::ESQLTypes kSqlObjectData
static const TSQLStructure::ESQLColumns kColUnknown
static const TSQLStructure::ESQLColumns kColSimple
static const TSQLStructure::ESQLColumns kColSimpleArray
static const TSQLStructure::ESQLColumns kColParent
static const TSQLStructure::ESQLColumns kColObject
static const TSQLStructure::ESQLColumns kColObjectArray
static const TSQLStructure::ESQLColumns kColNormObject
static const TSQLStructure::ESQLColumns kColNormObjectArray
static const TSQLStructure::ESQLColumns kColObjectPtr
static const TSQLStructure::ESQLColumns kColTString
static const TSQLStructure::ESQLColumns kColClonesArray
static const TSQLStructure::ESQLColumns kColRawData
This is hierarhical structure, which is created when data is written
by TBufferSQL2. It contains data all structurual information such:
version of written class, data memeber types of that class, value for
each data memeber and so on.
Such structure in some sense similar to XML node and subnodes structure
Once it created, it converted to SQL statements, which are submitted
to database server.
________________________________________________________________________
TSQLStructure() :
TObject(),
fParent(0),
fType(0),
fPointer(0),
fValue(),
fArrayIndex(-1),
fRepeatCnt(0),
fChilds()
default constructor
~TSQLStructure()
destructor
Int_t NumChilds() const
number of child structures
TSQLStructure* GetChild(Int_t n) const
return child structure of index n
void SetObjectRef(Int_t refid, const TClass* cl)
set structure type as kSqlObject
void SetObjectPointer(Int_t ptrid)
set structure type as kSqlPointer
void SetVersion(const TClass* cl, Int_t version)
set structure type as kSqlVersion
void SetClassStreamer(const TClass* cl)
set structure type as kSqlClassStreamer
void SetStreamerInfo(const TStreamerInfo* info)
set structure type as kSqlStreamerInfo
void SetStreamerElement(const TStreamerElement* elem, Int_t number)
set structure type as kSqlElement
void SetValue(const char* value, const char* tname)
set structure type as kSqlValue
void ChangeValueOnly(const char* value)
change value of this structure
used as "workaround" to keep object id in kSqlElement node
void SetArrayIndex(Int_t indx, Int_t cnt)
set array index for this structure
void ChildArrayIndex(Int_t index, Int_t cnt)
set array index for last child element
if (cnt<=1) return;
void SetArray(Int_t sz)
Set structure as array element
TClass* GetObjectClass() const
return object class if type kSqlObject
TClass* GetVersionClass() const
return class for version tag if type is kSqlVersion
TStreamerInfo* GetStreamerInfo() const
return TStreamerInfo* if type is kSqlStreamerInfo
TStreamerElement* GetElement() const
return TStremerElement* if type is kSqlElement
Int_t GetElementNumber() const
returns number of TStremerElement in TStreamerInfo
const char* GetValueType() const
return value type if structure is kSqlValue
const char* GetValue() const
returns value
for different structure kinds has different sense
For kSqlVersion it version, for kSqlReference it is object id and so on
void Add(TSQLStructure* child)
Add child strucure
void AddVersion(const TClass* cl, Int_t version)
add child as version
void AddValue(const char* value, const char* tname)
Add child structure as value
Int_t DefineObjectId()
defines current object id, to which this structure belong
make life complicated, because some objects do not get id
automatically in TBufferSQL, but afterwards
Bool_t IsClonesArray()
defines if this structure below node, which correspondes to
clones array. Used to force convertion of all data into raw format
void SetObjectData(TSQLObjectData* objdata)
set element to be used for object data
void AddObjectData(TSQLObjectData* objdata)
add element with pointer to object data
TSQLObjectData* GetObjectData(Bool_t search)
searchs for objects data
void Print(Option_t*) const
print content of complete structure
void PrintLevel(Int_t level) const
print content of current structure
void AddCmd(TObjArray* cmds,
const char* name, const char* value,
const char* topname, const char* ns)
Add SQL command for raw table
Bool_t IsNumericType(Int_t typ)
defines if value is numeric and not requires quotes when writing
const char* GetSimpleTypeName(Int_t typ)
provides name for basic types
used as suffix for column name or field suffix in raw table
Int_t FindMaxRef()
define maximum reference id, used for objects
Bool_t ConvertToTables(TSQLFile* file, Int_t keyid, TObjArray* cmds)
Convert structure to sql statements
This function is called immidiately after TBufferSQL2 produces
this structure with object data
Should be only called for toplevel structure
void PerformConversion(TSqlRegistry* reg, TObjArray* blobs, const char* topname, Bool_t useblob)
perform conversion of structure to sql statements
first tries convert it to normal form
if fails, produces data for raw table
Bool_t StoreObject(TSqlRegistry* reg, const char* objid, TClass* cl, Bool_t registerobj)
convert object data to sql statements
if normal (columnwise) representation is not possible,
complete object will be converted to raw format
Bool_t StoreObjectInNormalForm(TSqlRegistry* reg)
this function verify object child elements and
calls transformation to class table
Bool_t StoreClassInNormalForm(TSqlRegistry* reg)
produces data for complete class table
where not possible, raw data for some elements are created
TString MakeArrayIndex(TStreamerElement* elem, Int_t index)
produce string with complete index like [1][2][0]
Bool_t StoreElementInNormalForm(TSqlRegistry* reg, TObjArray* columns)
tries to store element data in column
Bool_t TryConvertObjectArray(TSqlRegistry* reg, TObjArray* blobs)
tries to write array of objects as lis of object refereneces
in _streamer_ table, while objects itself will be stored in
other tables. If not successfull, object data will be stored
in _streamer_ table
Bool_t CheckNormalClassPair(TSQLStructure* s_ver, TSQLStructure* s_info)
check if pair of two element corresponds
to start of object, stored in normal form
Bool_t StoreTObject(TSqlRegistry* reg)
store data of TObject in special table
workaround custom TObject streamer
Bool_t StoreTString(TSqlRegistry* reg)
store data of TString in special table
it is required when TString stored as pointer and reference to it possible
Bool_t RecognizeTString(const char* &value)
prove that structure containes TString data
Int_t DefineElementColumnType(TStreamerElement* elem, TSQLFile* f)
defines which kind of column can be assigned for this element
Possible cases
kColSimple - basic data type
kColSimpleArray - fixed arary of basic types
kColParent - parent class
kColObject - object as data memeber
kColObjectPtr - object as pointer
kColTString - TString
kColRawData - anything else as raw data
TString DefineElementColumnName(TStreamerElement* elem, TSQLFile* f, Int_t indx)
returns name of the column in class table for that element
Int_t LocateElementColumn(TSQLFile* f, TSQLObjectData* data)
find column in TSQLObjectData object, which correspond to current element
Bool_t UnpackTObject(TSQLFile* f, TSQLObjectData* data, Int_t objid, Int_t clversion)
Unpack TObject data in form, understodable by custom TObject streamer
Bool_t UnpackTString(TSQLFile* f, TSQLObjectData* data, Int_t objid, Int_t clversion)
Unpack TString data in form, understodable by custom TString streamer
Inline Functions
TSQLStructure* GetParent() const
void SetParent(TSQLStructure* p)
void SetType(Int_t typ)
Int_t GetType() const
Int_t GetArrayIndex() const
Int_t GetRepeatCounter() const
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
Author: Sergey Linev 20/11/2005
Last update: root/sql:$Name: $:$Id: TSQLStructure.cxx,v 1.7 2005/12/07 14:59:57 rdm Exp $
Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.