TDbiFieldType.hxx
Go to the documentation of this file.00001
00002 #ifndef DBIFIELDTYPE_H
00003 #define DBIFIELDTYPE_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include <string>
00030 using std::string;
00031
00032 #include "TDbi.hxx"
00033
00034
00035 class TDbiFieldType
00036 {
00037
00038
00039 public:
00040
00041 enum PrecisionLimits{ kMaxTinyInt = 4,
00042 kMaxSmallInt = 6,
00043 kMaxInt = 11,
00044 kMaxChar = 3,
00045 kMaxMySQLVarchar = 255,
00046 kMaxMySQLText = 65535
00047 };
00048
00049
00050 TDbiFieldType(Int_t type = TDbi::kInt);
00051 TDbiFieldType(Int_t type,
00052 Int_t size,
00053 const char* typeName);
00054 TDbiFieldType(const TDbiFieldType& from);
00055 TDbiFieldType(const string& sql,
00056 Int_t size);
00057 virtual ~TDbiFieldType();
00058
00059
00060
00061 string AsString() const;
00062 string AsSQLString() const;
00063 string UndefinedValue() const;
00064 UInt_t GetConcept() const { return fConcept; }
00065 UInt_t GetSize() const { return fSize; }
00066 UInt_t GetType() const { return fType; }
00067 Bool_t IsCompatible(const TDbiFieldType& other) const;
00068 Bool_t IsEqual(const TDbiFieldType& other) const
00069 { return fType == other.fType; }
00070 Bool_t IsSmaller(const TDbiFieldType& other) const
00071 { return fSize < other.fSize; }
00072 Bool_t IsSigned() const { return fConcept == TDbi::kInt; }
00073
00074
00075
00076
00077 void SetUnsigned() {if (this->IsSigned()) {++fConcept; ++fType;}}
00078
00079 private:
00080
00081 void Init(Int_t type, Int_t size = -1);
00082
00083
00084
00085
00086 unsigned int fConcept;
00087
00088 unsigned int fSize;
00089
00090 unsigned int fType;
00091
00092 ClassDef(TDbiFieldType,0)
00093
00094 };
00095
00096
00097 #endif // DBIFIELDTYPE_H
00098