Go to the documentation of this file.00001
00002
00003
00004
00005
00008
00009 #ifndef databaseColumn_H_
00010 #define databaseColumn_H_
00011
00012 #include "vlDatabase.h"
00013
00014
00015 #include <list>
00016 #include <vlutil/vlString.h>
00017 #include <vector>
00018
00019
00020
00021
00022
00023
00024
00025
00026 class DT_DLL_VLDB DtDatabaseColumn
00027 {
00028 public:
00029
00030
00031
00032 enum DataType
00033 {
00034 Type_SqlNone = 0,
00035 Type_SqlChar = 1,
00036 Type_SqlShort = 2,
00037 Type_SqlInt = 3,
00038 Type_SqlLong = 4,
00039 Type_SqlFloat = 5,
00040 Type_SqlDouble = 6,
00041 Type_SqlFixedString = 7,
00042 Type_SqlVarString = 8,
00043 Type_SqlIndex = 9,
00044
00045 Type_SqlEnum8 = 10,
00046 Type_SqlEnum16 = 11,
00047 Type_SqlEnum32 = 12,
00048 Type_SqlBool = 13,
00049 Type_SqlUnsignedShort = 15,
00050 Type_SqlUnsignedInt = 16,
00051 Type_SqlUnsignedLong = 17
00052 };
00053
00055 typedef std::list<DtString> IndexNameList;
00056
00057
00058 DtDatabaseColumn(const DtString& columnName, DataType columnType );
00059
00060
00061 virtual ~DtDatabaseColumn();
00062
00063
00064 DtDatabaseColumn( const DtDatabaseColumn& src );
00065
00066
00067 virtual DtDatabaseColumn& operator=(const DtDatabaseColumn& src );
00068
00069
00070 const DtString& columnName() const;
00072 virtual void setColumnName(const DtString&);
00073
00074
00075 DataType columnType() const;
00076 virtual void setColumnType(DataType type);
00077
00078
00079 bool hasDisplaySize() const;
00080
00081
00082 bool hasDefaultValue() const;
00083
00084
00085
00086
00087 int displaySize() const;
00088 void setDisplaySize(int displaySize );
00089
00090
00091 int numDecimals() const;
00092 void setNumDecimals( int numDecimals );
00093
00094
00095 bool isUnsigned() const;
00096 void setIsUnsigned( bool isUnsigned );
00097
00098
00099 bool nullAllow() const;
00100 void setNullAllow( bool nullAllow );
00101
00102
00103
00104 const DtString& defaultValue() const;
00105 void setDefaultValue( const DtString& defaultValue );
00106
00107
00108
00109 bool autoIncrement() const;
00110 void setAutoIncrement( bool autoIncrement );
00111
00112
00113 bool isPrimaryKey() const;
00114 void setIsPrimaryKey( bool isPrimaryKey );
00115
00116
00117 bool isSecondaryKey() const;
00118 void setIsSecondaryKey( bool isSecondaryKey );
00119
00120
00121
00122 const IndexNameList& indexNameList() const;
00123
00124
00125 void addIndexName( const DtString& indexName );
00126
00127
00128 void clearIndexNameList();
00129
00130
00131 const DtString& value() const;
00132
00133
00134 void setValue(const DtString& value);
00135
00136
00137 int valueCount() const;
00138
00139
00140 const DtString& value(size_t index) const;
00141
00142
00143 void addValue(const DtString& value);
00144
00145
00146 bool isNull(size_t index) const;
00147
00148
00149 static DataType dataTypeFromNativeType(const DtString& naticeCType);
00150
00151 protected:
00152
00153 static DtString theNullString;
00154
00155 DtString myColumnName;
00156 DtString myDefaultValue;
00157
00158 std::vector<DtString> myStringReps;
00159 IndexNameList myIndexNameList;
00160
00161 DataType myColumnType;
00162
00163 int myDisplaySize;
00164 int myNumDecimals;
00165
00166 bool myAutoIncrement;
00167 bool myHasDefaultValue;
00168 bool myHasDisplaySize;
00169 bool myIsPrimaryKey;
00170 bool myIsSecondaryKey;
00171 bool myIsUnsigned;
00172 bool myNullAllow;
00173
00174 };
00175
00176
00177 #endif