library: libSQL
#include "TSQLStructure.h"

TSQLStructure


class description - header file - source file - inheritance tree (.pdf)

class TSQLStructure : public TObject

Inheritance Chart:
TObject
<-
TSQLStructure

    protected:
Bool_t CheckNormalClassPair(TSQLStructure* vers, TSQLStructure* info) Long64_t FindMaxObjectId() void PerformConversion(TSqlRegistry* reg, TSqlRawBuffer* blobs, const char* topname, Bool_t useblob = kFALSE) Bool_t RecognizeTString(const char*& value) Bool_t StoreClassInNormalForm(TSqlRegistry* reg) Bool_t StoreElementInNormalForm(TSqlRegistry* reg, TSQLTableData* columns) Bool_t StoreObject(TSqlRegistry* reg, Long64_t 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, TSqlRawBuffer* blobs) public:
TSQLStructure() TSQLStructure(const TSQLStructure&) virtual ~TSQLStructure() void Add(TSQLStructure* child) void AddObjectData(TSQLObjectData* objdata) static void AddStrBrackets(TString& s, const char* quote) 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, Long64_t keyid, TObjArray* cmds) static TString DefineElementColumnName(TStreamerElement* elem, TSQLFile* f, Int_t indx = 0) static Int_t DefineElementColumnType(TStreamerElement* elem, TSQLFile* f) Long64_t DefineObjectId(Bool_t recursive = kTRUE) Int_t GetArrayIndex() const TSQLStructure* GetChild(Int_t n) const Bool_t GetClassInfo(TClass*& cl, Version_t& version) TClass* GetCustomClass() const Version_t GetCustomClassVersion() 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) TStreamerInfo* GetStreamerInfo() const Int_t GetType() const const char* GetValue() const const char* GetValueType() const TClass* GetVersionClass() const virtual TClass* IsA() const static Bool_t IsNumericType(Int_t typ) Int_t LocateElementColumn(TSQLFile* f, TBufferSQL2* buf, 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 SetCustomClass(const TClass* cl, Version_t version) void SetCustomElement(TStreamerElement* elem) void SetObjectData(TSQLObjectData* objdata) void SetObjectPointer(Long64_t ptrid) void SetObjectRef(Long64_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, TBufferSQL2* buf, TSQLObjectData* data, Long64_t objid, Int_t clversion) static Bool_t UnpackTString(TSQLFile* f, TBufferSQL2* buf, TSQLObjectData* data, Long64_t objid, Int_t clversion)

Data Members


    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::ESQLTypes kSqlCustomClass static const TSQLStructure::ESQLTypes kSqlCustomElement 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 kColRawData static const TSQLStructure::ESQLIdType kIdTable static const TSQLStructure::ESQLIdType kIdRawTable static const TSQLStructure::ESQLIdType kIdColumn

Class Description

________________________________________________________________________

  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()
 default constructor
~TSQLStructure()
 destructor
Int_t NumChilds()
 number of child structures
TSQLStructure* GetChild(Int_t n)
 return child structure of index n
void SetObjectRef(Long64_t refid, const TClass* cl)
 set structure type as kSqlObject
void SetObjectPointer(Long64_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 SetCustomClass(const TClass* cl, Version_t version)
 set structure type as kSqlCustomClass
void SetCustomElement(TStreamerElement* elem)
 set structure type as kSqlCustomElement
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()
 return object class if type kSqlObject
TClass* GetVersionClass()
 return class for version tag if type is kSqlVersion
TStreamerInfo* GetStreamerInfo()
 return TStreamerInfo* if type is kSqlStreamerInfo
TStreamerElement* GetElement()
 return TStremerElement* if type is kSqlElement
Int_t GetElementNumber()
 returns number of TStremerElement in TStreamerInfo
const char* GetValueType()
 return value type if structure is kSqlValue
TClass* GetCustomClass()
 return element custom class if strutures is kSqlCustomClass
Version_t GetCustomClassVersion()
 return custom class version if strutures is kSqlCustomClass
Bool_t GetClassInfo(TClass* &cl, Version_t &version)
 provides class info if structure kSqlStreamerInfo or kSqlCustomClass
const char* GetValue()
 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
Long64_t DefineObjectId(Bool_t recursive)
 defines current object id, to which this structure belong
 make life complicated, because some objects do not get id
 automatically in TBufferSQL, but afterwards
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*)
 print content of complete structure
void PrintLevel(Int_t level)
 print content of current structure
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
Long64_t FindMaxObjectId()
 define maximum reference id, used for objects
Bool_t ConvertToTables(TSQLFile* file, Long64_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, TSqlRawBuffer* 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, Long64_t 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, TSQLTableData* columns)
 tries to store element data in column
Bool_t TryConvertObjectArray(TSqlRegistry* reg, TSqlRawBuffer* 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, TBufferSQL2* buf, TSQLObjectData* data)
 find column in TSQLObjectData object, which correspond to current element
Bool_t UnpackTObject(TSQLFile* f, TBufferSQL2* buf, TSQLObjectData* data, Long64_t objid, Int_t clversion)
 Unpack TObject data in form, understodable by custom TObject streamer
Bool_t UnpackTString(TSQLFile* f, TBufferSQL2* buf, TSQLObjectData* data, Long64_t objid, Int_t clversion)
 Unpack TString data in form, understodable by custom TString streamer
void AddStrBrackets(TString &s, const char* quote)
 adds quotes arround string value and replaces some special symbols
const char* GetType()
TSQLStructure()
TSQLStructure* GetParent()
void SetParent(TSQLStructure* p)
void SetType(Int_t typ)
Int_t GetArrayIndex()
Int_t GetRepeatCounter()

Author: Sergey Linev 20/11/2005
Last update: root/sql:$Name: $:$Id: TSQLStructure.cxx,v 1.13 2006/06/22 08:21:22 brun 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.