EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FairDbFieldType.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FairDbFieldType.h
1 
2 #ifndef FAIRDBFIELDTYPE_H
3 #define FAIRDBFIELDTYPE_H
4 
5 
6 #include <string>
7 using std::string;
8 
9 #include "FairDb.h"
10 
12 {
13  public:
14 
17  kMaxInt = 11,
18  kMaxChar = 3,
22  kMaxMySQLText = 65535
23  };
24 
25 // Constructors and destructors.
26  FairDbFieldType(Int_t type = FairDb::kInt);
27  FairDbFieldType(Int_t type,
28  Int_t size,
29  const char* typeName);
30  FairDbFieldType(const FairDbFieldType& from);
31  FairDbFieldType(const string& sql,
32  Int_t size);
33  virtual ~FairDbFieldType();
34 
35 
36  string AsString() const;
37  string AsSQLString(FairDb::DbTypes dbType = FairDb::kMySQL) const;
38  string UndefinedValue() const;
39  UInt_t GetConcept() const { return fConcept; }
40  UInt_t GetSize() const { return fSize; }
41  UInt_t GetType() const { return fType; }
42  Bool_t IsCompatible(const FairDbFieldType& other) const;
43  Bool_t IsEqual(const FairDbFieldType& other) const
44  { return fType == other.fType; }
45  Bool_t IsSmaller(const FairDbFieldType& other) const
46  { return fSize < other.fSize; }
47  Bool_t IsSigned() const { return fConcept == FairDb::kInt; }
48 
49 
50  void SetUnsigned() {if (this->IsSigned()) {++fConcept; ++fType;}}
51 
52  private:
53 
54  void Init(Int_t type, Int_t size = -1);
55 
56  unsigned int fConcept;
57  unsigned int fSize;
58  unsigned int fType;
59 
60  ClassDef(FairDbFieldType,0) // Table column field types.
61 
62 };
63 
64 #endif // FAIRDBFIELDTYPE_H