Logo ROOT   6.21/01
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
TObjArray * GetColumns() const
Definition: TSQLClassInfo.h:65
void SetClassTableName(const char *name)
Definition: TSQLClassInfo.h:52
An array of TObjects.
Definition: TObjArray.h:37
long long Long64_t
Definition: RtypesCore.h:69
const char * GetClassTableName() const
Definition: TSQLClassInfo.h:55
void SetRawTableName(const char *name)
Definition: TSQLClassInfo.h:53
virtual ~TSQLClassInfo()
destructor
Contains information about tables specific to one class and version.
Definition: TSQLClassInfo.h:41
Basic string class.
Definition: TString.h:131
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void SetTableStatus(TObjArray *columns=0, Bool_t israwtable=kFALSE)
set current status of class tables
Long64_t fClassId
! sql class id
Definition: TSQLClassInfo.h:71
TObjArray * fColumns
! name and type of columns - array of TNamed
Definition: TSQLClassInfo.h:74
TString fClassName
! class name
Definition: TSQLClassInfo.h:69
Long64_t GetClassId() const
Definition: TSQLClassInfo.h:47
ClassDefOverride(TSQLClassInfo, 1)
Bool_t IsClassTableExist() const
Definition: TSQLClassInfo.h:62
const char * GetName() const final
Returns name of object.
Definition: TSQLClassInfo.h:49
const char * GetSQLName() const
Definition: TSQLClassInfo.h:28
TString fClassTable
! name of table with class data
Definition: TSQLClassInfo.h:72
void SetRawExist(Bool_t on)
Definition: TSQLClassInfo.h:60
Bool_t fRawtableExist
! indicate that raw table is exist
Definition: TSQLClassInfo.h:75
const char * GetRawTableName() const
Definition: TSQLClassInfo.h:56
const Bool_t kFALSE
Definition: RtypesCore.h:88
Int_t GetClassVersion() const
Definition: TSQLClassInfo.h:50
const char * GetSQLType() const
Definition: TSQLClassInfo.h:29
ClassDefOverride(TSQLClassColumnInfo, 1)
Mother of all ROOT objects.
Definition: TObject.h:37
Int_t fClassVersion
! class version
Definition: TSQLClassInfo.h:70
TString fRawTable
! name of table with raw data
Definition: TSQLClassInfo.h:73
Int_t FindColumn(const char *name, Bool_t sqlname=kFALSE)
Search for column of that name.
Bool_t IsRawTableExist() const
Definition: TSQLClassInfo.h:63
char name[80]
Definition: TGX11.cxx:109
const char * GetName() const final
Returns name of object.
Definition: TSQLClassInfo.h:27
void SetColumns(TObjArray *columns)
assigns new list of columns
const char * Data() const
Definition: TString.h:364