EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
FairDbTableMetaData.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FairDbTableMetaData.h
1
#ifndef FAIRDBTABLEMETADATA_H
2
#define FAIRDBTABLEMETADATA_H
3
4
5
#include <string>
6
using
std::string;
7
#include <vector>
8
9
#include "
FairDbFieldType.h
"
10
11
class
FairDbTableMetaData
12
{
13
14
friend
class
FairDbProxy
;
//
15
16
public
:
17
18
FairDbTableMetaData
(
const
string
& tableName =
"Unknown"
);
19
virtual
~FairDbTableMetaData
();
20
21
// Return SQL string to create table.
22
string
Sql
(
FairDb::DbTypes
dbType =
FairDb::kMySQL
)
const
;
23
24
string
TableName
()
const
{
return
fTableName
; }
25
Bool_t
HasRowCounter
()
const
{
return
this->
NumCols
() >=2 && this->
ColName
(2) ==
"ROW_COUNTER"
; }
26
UInt_t
NumCols
()
const
{
return
fNumCols
;}
27
28
// Column attribute getters (columns number starts from 1 NOT zero)
29
30
const
FairDbFieldType
&
ColFieldType
(Int_t colNum)
const
{
return
GetAttributes
(colNum).
Type
;}
31
UInt_t
ColFieldConcept
(Int_t colNum)
const
{
return
GetAttributes
(colNum).
Concept
;}
32
Bool_t
ColIsNullable
(Int_t colNum)
const
{
return
GetAttributes
(colNum).
IsNullable
;}
33
Bool_t
ColMustDelimit
(Int_t colNum)
const
{
return
GetAttributes
(colNum).
MustDelimit
;}
34
string
ColName
(Int_t colNum)
const
{
return
GetAttributes
(colNum).
Name
;}
35
36
// Recreate from SQL used to create table.
37
void
SetFromSql
(
const
string
& sql);
38
39
protected
:
40
41
void
Clear
();
42
void
SetColIsNullable
(Int_t colNum, Bool_t isNullable =
true
) {
SetAttributes
(colNum).
IsNullable
= isNullable;}
43
void
SetColName
(
const
string
&
name
, Int_t colNum) {
SetAttributes
(colNum).
Name
=
name
;}
44
void
SetColFieldType
(
const
FairDbFieldType
& type, Int_t colNum);
45
46
private
:
47
48
static
string
GetToken
(
const
char
*& strPtr);
49
50
//Sanity check: limit number of columns.
51
enum
{
MAXCOL
= 1000};
52
53
void
ExpandTo
(UInt_t colNum);
54
56
struct
ColumnAttributes
{
57
ColumnAttributes
() :
Name
(
"Unknown"
),
Concept
(FairDb::
kUnknown
),
58
MustDelimit
(
false
),
IsNullable
(
false
),
Type
(FairDb::
kUnknown
) { };
59
void
SetDefault
() {
60
Name
=
"Unknown"
;
61
Concept
=
FairDb::kUnknown
;
62
MustDelimit
=
false
;
63
IsNullable
=
false
;
64
Type
=
FairDb::kUnknown
;
65
}
66
string
Name
;
67
Int_t
Concept
;
68
Bool_t
MustDelimit
;
69
Bool_t
IsNullable
;
70
FairDbFieldType
Type
;
71
};
72
73
static
ColumnAttributes
fgDummy
;
74
const
ColumnAttributes
&
GetAttributes
(Int_t colNum)
const
;
75
ColumnAttributes
&
SetAttributes
(Int_t colNum);
76
77
std::vector<ColumnAttributes>
fColAttr
;
78
UInt_t
fNumCols
;
79
string
fTableName
;
80
81
ClassDef(
FairDbTableMetaData
,0)
//TableMetaData for database table
82
83
};
84
85
86
#endif // FAIRDBTABLEMETADATA_H
EicRoot
blob
master
dbase
dbInterface
FairDbTableMetaData.h
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:33
using
1.8.2 with
EIC GitHub integration