Logo ROOT  
Reference Guide
TSQLClassInfo.h
Go to the documentation of this file.
1 // @(#)root/sql:$Id$
2 // Author: Sergey Linev 20/11/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TSQLClassInfo
13 #define ROOT_TSQLClassInfo
14 
15 #include "TObject.h"
16 
17 #include "TString.h"
18 
19 class TObjArray;
20 
21 class TSQLClassColumnInfo final : public TObject {
22 
23 public:
24  TSQLClassColumnInfo() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
25  TSQLClassColumnInfo(const char *name, const char *sqlname, const char *sqltype);
26 
27  const char *GetName() const final { return fName.Data(); }
28  const char *GetSQLName() const { return fSQLName.Data(); }
29  const char *GetSQLType() const { return fSQLType.Data(); }
30 
31 protected:
35 
36  ClassDefOverride(TSQLClassColumnInfo, 1); // Keeps information about single column in class table
37 };
38 
39 //_________________________________________________________________________________
40 
41 class TSQLClassInfo final : public TObject {
42 public:
43  TSQLClassInfo() {} // NOLINT: not allowed to use = default because of TObject::kIsOnHeap detection, see ROOT-10300
44  TSQLClassInfo(Long64_t classid, const char *classname, Int_t version);
45  virtual ~TSQLClassInfo();
46 
47  Long64_t GetClassId() const { return fClassId; }
48 
49  const char *GetName() const final { return fClassName.Data(); }
50  Int_t GetClassVersion() const { return fClassVersion; }
51 
52  void SetClassTableName(const char *name) { fClassTable = name; }
53  void SetRawTableName(const char *name) { fRawTable = name; }
54 
55  const char *GetClassTableName() const { return fClassTable.Data(); }
56  const char *GetRawTableName() const { return fRawTable.Data(); }
57 
58  void SetTableStatus(TObjArray *columns = 0, Bool_t israwtable = kFALSE);
59  void SetColumns(TObjArray *columns);
60  void SetRawExist(Bool_t on) { fRawtableExist = on; }
61 
62  Bool_t IsClassTableExist() const { return GetColumns() != 0; }
64 
65  TObjArray *GetColumns() const { return fColumns; }
66  Int_t FindColumn(const char *name, Bool_t sqlname = kFALSE);
67 
68 protected:
69  TString fClassName; ///<! class name
70  Int_t fClassVersion{0}; ///<! class version
71  Long64_t fClassId{0}; ///<! sql class id
72  TString fClassTable; ///<! name of table with class data
73  TString fRawTable; ///<! name of table with raw data
74  TObjArray *fColumns{nullptr}; ///<! name and type of columns - array of TNamed
75  Bool_t fRawtableExist{kFALSE}; ///<! indicate that raw table is exist
76 
77  ClassDefOverride(TSQLClassInfo, 1); // Keeps the table information relevant for one class
78 };
79 
80 #endif
TSQLClassInfo::fClassName
TString fClassName
! class name
Definition: TSQLClassInfo.h:69
TSQLClassInfo::SetRawExist
void SetRawExist(Bool_t on)
Definition: TSQLClassInfo.h:60
TSQLClassColumnInfo::ClassDefOverride
ClassDefOverride(TSQLClassColumnInfo, 1)
TSQLClassInfo::IsRawTableExist
Bool_t IsRawTableExist() const
Definition: TSQLClassInfo.h:63
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
TSQLClassInfo::fClassId
Long64_t fClassId
! sql class id
Definition: TSQLClassInfo.h:71
TSQLClassInfo
Contains information about tables specific to one class and version.
Definition: TSQLClassInfo.h:41
TSQLClassColumnInfo::GetSQLName
const char * GetSQLName() const
Definition: TSQLClassInfo.h:28
TString::Data
const char * Data() const
Definition: TString.h:369
TSQLClassColumnInfo::fSQLType
TString fSQLType
Definition: TSQLClassInfo.h:34
TSQLClassInfo::fClassVersion
Int_t fClassVersion
! class version
Definition: TSQLClassInfo.h:70
Long64_t
long long Long64_t
Definition: RtypesCore.h:73
Int_t
int Int_t
Definition: RtypesCore.h:45
TSQLClassInfo::GetRawTableName
const char * GetRawTableName() const
Definition: TSQLClassInfo.h:56
TSQLClassInfo::GetClassVersion
Int_t GetClassVersion() const
Definition: TSQLClassInfo.h:50
TString
Basic string class.
Definition: TString.h:136
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TString.h
TSQLClassColumnInfo::fName
TString fName
Definition: TSQLClassInfo.h:32
bool
TSQLClassColumnInfo::TSQLClassColumnInfo
TSQLClassColumnInfo()
Definition: TSQLClassInfo.h:24
TSQLClassInfo::SetRawTableName
void SetRawTableName(const char *name)
Definition: TSQLClassInfo.h:53
TSQLClassInfo::ClassDefOverride
ClassDefOverride(TSQLClassInfo, 1)
TSQLClassInfo::fRawTable
TString fRawTable
! name of table with raw data
Definition: TSQLClassInfo.h:73
TSQLClassColumnInfo::GetName
const char * GetName() const final
Returns name of object.
Definition: TSQLClassInfo.h:27
TSQLClassInfo::TSQLClassInfo
TSQLClassInfo()
Definition: TSQLClassInfo.h:43
TSQLClassInfo::GetColumns
TObjArray * GetColumns() const
Definition: TSQLClassInfo.h:65
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TSQLClassInfo::fRawtableExist
Bool_t fRawtableExist
! indicate that raw table is exist
Definition: TSQLClassInfo.h:75
TSQLClassInfo::IsClassTableExist
Bool_t IsClassTableExist() const
Definition: TSQLClassInfo.h:62
TSQLClassInfo::fColumns
TObjArray * fColumns
! name and type of columns - array of TNamed
Definition: TSQLClassInfo.h:74
TSQLClassInfo::GetName
const char * GetName() const final
Returns name of object.
Definition: TSQLClassInfo.h:49
TSQLClassInfo::SetClassTableName
void SetClassTableName(const char *name)
Definition: TSQLClassInfo.h:52
TSQLClassInfo::FindColumn
Int_t FindColumn(const char *name, Bool_t sqlname=kFALSE)
Search for column of that name.
Definition: TSQLClassInfo.cxx:87
TSQLClassColumnInfo
Definition: TSQLClassInfo.h:21
TObject.h
TSQLClassInfo::~TSQLClassInfo
virtual ~TSQLClassInfo()
destructor
Definition: TSQLClassInfo.cxx:54
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
name
char name[80]
Definition: TGX11.cxx:110
TSQLClassInfo::GetClassId
Long64_t GetClassId() const
Definition: TSQLClassInfo.h:47
TSQLClassInfo::fClassTable
TString fClassTable
! name of table with class data
Definition: TSQLClassInfo.h:72
TSQLClassColumnInfo::GetSQLType
const char * GetSQLType() const
Definition: TSQLClassInfo.h:29
TSQLClassColumnInfo::fSQLName
TString fSQLName
Definition: TSQLClassInfo.h:33
TSQLClassInfo::SetColumns
void SetColumns(TObjArray *columns)
assigns new list of columns
Definition: TSQLClassInfo.cxx:62
TSQLClassInfo::SetTableStatus
void SetTableStatus(TObjArray *columns=0, Bool_t israwtable=kFALSE)
set current status of class tables
Definition: TSQLClassInfo.cxx:74
TSQLClassInfo::GetClassTableName
const char * GetClassTableName() const
Definition: TSQLClassInfo.h:55
int