Logo ROOT   6.10/09
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 : public TObject {
22 
23 public:
25  TSQLClassColumnInfo(const char* name,
26  const char* sqlname,
27  const char* sqltype);
28  virtual ~TSQLClassColumnInfo();
29 
30  virtual const char* GetName() const { return fName.Data(); }
31  const char* GetSQLName() const { return fSQLName.Data(); }
32  const char* GetSQLType() const { return fSQLType.Data(); }
33 
34 protected:
38 
39  ClassDef(TSQLClassColumnInfo, 1); // Keeps information about single column in class table
40 };
41 
42 //_________________________________________________________________________________
43 
44 class TSQLClassInfo : public TObject {
45 public:
46  TSQLClassInfo();
47  TSQLClassInfo(Long64_t classid,
48  const char* classname,
49  Int_t version);
50  virtual ~TSQLClassInfo();
51 
52 
53  Long64_t GetClassId() const { return fClassId; }
54 
55  virtual const char* GetName() const { return fClassName.Data(); }
56  Int_t GetClassVersion() const { return fClassVersion; }
57 
58  void SetClassTableName(const char* name) { fClassTable = name; }
59  void SetRawTableName(const char* name) { fRawTable = name; }
60 
61  const char* GetClassTableName() const { return fClassTable.Data(); }
62  const char* GetRawTableName() const { return fRawTable.Data(); }
63 
64  void SetTableStatus(TObjArray* columns = 0, Bool_t israwtable = kFALSE);
65  void SetColumns(TObjArray* columns);
66  void SetRawExist(Bool_t on) { fRawtableExist = on; }
67 
68  Bool_t IsClassTableExist() const { return GetColumns()!=0; }
69  Bool_t IsRawTableExist() const { return fRawtableExist; }
70 
71  TObjArray* GetColumns() const { return fColumns; }
72  Int_t FindColumn(const char* name, Bool_t sqlname = kFALSE);
73 
74 protected:
75 
76  TString fClassName; ///<! class name
77  Int_t fClassVersion; ///<! class version
78  Long64_t fClassId; ///<! sql class id
79  TString fClassTable; ///<! name of table with class data
80  TString fRawTable; ///<! name of table with raw data
81  TObjArray* fColumns; ///<! name and type of columns - array of TNamed
82  Bool_t fRawtableExist; ///<! indicate that raw table is exist
83 
84  ClassDef(TSQLClassInfo, 1); // Keeps the table information relevant for one class
85 };
86 
87 #endif
TObjArray * GetColumns() const
Definition: TSQLClassInfo.h:71
void SetClassTableName(const char *name)
Definition: TSQLClassInfo.h:58
An array of TObjects.
Definition: TObjArray.h:37
long long Long64_t
Definition: RtypesCore.h:69
const char * GetClassTableName() const
Definition: TSQLClassInfo.h:61
void SetRawTableName(const char *name)
Definition: TSQLClassInfo.h:59
virtual const char * GetName() const
Returns name of object.
Definition: TSQLClassInfo.h:55
Contains information about tables specific to one class and version.
Definition: TSQLClassInfo.h:44
Basic string class.
Definition: TString.h:129
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual ~TSQLClassColumnInfo()
destructor
Long64_t fClassId
! sql class id
Definition: TSQLClassInfo.h:78
TObjArray * fColumns
! name and type of columns - array of TNamed
Definition: TSQLClassInfo.h:81
#define ClassDef(name, id)
Definition: Rtypes.h:297
TString fClassName
! class name
Definition: TSQLClassInfo.h:76
Long64_t GetClassId() const
Definition: TSQLClassInfo.h:53
Bool_t IsClassTableExist() const
Definition: TSQLClassInfo.h:68
const char * GetSQLName() const
Definition: TSQLClassInfo.h:31
TSQLClassColumnInfo()
default constructor
TString fClassTable
! name of table with class data
Definition: TSQLClassInfo.h:79
void SetRawExist(Bool_t on)
Definition: TSQLClassInfo.h:66
Bool_t fRawtableExist
! indicate that raw table is exist
Definition: TSQLClassInfo.h:82
const char * GetRawTableName() const
Definition: TSQLClassInfo.h:62
const Bool_t kFALSE
Definition: RtypesCore.h:92
Int_t GetClassVersion() const
Definition: TSQLClassInfo.h:56
const char * GetSQLType() const
Definition: TSQLClassInfo.h:32
Mother of all ROOT objects.
Definition: TObject.h:37
Int_t fClassVersion
! class version
Definition: TSQLClassInfo.h:77
virtual const char * GetName() const
Returns name of object.
Definition: TSQLClassInfo.h:30
TString fRawTable
! name of table with raw data
Definition: TSQLClassInfo.h:80
Bool_t IsRawTableExist() const
Definition: TSQLClassInfo.h:69
const char * Data() const
Definition: TString.h:347