Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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:
32  TString fName;
33  TString fSQLName;
34  TString fSQLType;
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; }
63  Bool_t IsRawTableExist() const { return fRawtableExist; }
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