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