/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 00002 #ifndef DBIFIELDTYPE_H 00003 #define DBIFIELDTYPE_H 00004 00005 00009 00030 #include <string> 00031 using std::string; 00032 00033 #include "DatabaseInterface/Dbi.h" 00034 00035 class DbiFieldType 00036 { 00037 00038 00039 public: 00040 00041 enum PrecisionLimits{ kMaxTinyInt = 4, 00042 kMaxSmallInt = 6, 00043 kMaxInt = 11, 00044 kMaxChar = 3, 00045 kMaxOracleFloat = 32, 00046 kMaxMySQLVarchar = 255, 00047 kMaxOracleVarchar = 4000, 00048 kMaxMySQLText = 65535 00049 }; 00050 00051 // Constructors and destructors. 00052 DbiFieldType(Int_t type = Dbi::kInt); 00053 DbiFieldType(Int_t type, 00054 Int_t size, 00055 const char* typeName); 00056 DbiFieldType(const DbiFieldType& from); 00057 DbiFieldType(const string& sql, 00058 Int_t size); 00059 virtual ~DbiFieldType(); 00060 00061 // State testing member functions 00062 00063 string AsString() const; 00064 string AsSQLString(Dbi::DbTypes dbType = Dbi::kMySQL) const; 00065 string UndefinedValue() const; 00066 UInt_t GetConcept() const { return fConcept; } 00067 UInt_t GetSize() const { return fSize; } 00068 UInt_t GetType() const { return fType; } 00069 Bool_t IsCompatible(const DbiFieldType& other) const; 00070 Bool_t IsEqual(const DbiFieldType& other) const 00071 { return fType == other.fType; } 00072 Bool_t IsSmaller(const DbiFieldType& other) const 00073 { return fSize < other.fSize; } 00074 Bool_t IsSigned() const { return fConcept == Dbi::kInt; } 00075 00076 00077 // State modifying member functions 00078 00079 void SetUnsigned() {if (this->IsSigned()) {++fConcept; ++fType;}} 00080 00081 private: 00082 00083 void Init(Int_t type, Int_t size = -1); 00084 00085 // Data members 00086 00088 unsigned int fConcept; 00090 unsigned int fSize; 00092 unsigned int fType; 00093 00094 // Removed: ClassDef(DbiFieldType,0) // Table column field types. 00095 00096 }; 00097 00098 #endif // DBIFIELDTYPE_H