00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _datacolumn_h
00018 #define _datacolumn_h
00019
00020 #include <spl/Debug.h>
00021 #include <spl/RefCountPtr.h>
00022 #include <spl/String.h>
00023 #include <spl/Variant.h>
00024
00031 class DbSqlType
00032 {
00033 public:
00034 enum
00035 {
00036 SQL_TYPE_UNASSIGNED = 0,
00037 SQL_TYPE_INT8 = 1,
00038 SQL_TYPE_INT16 = 2,
00039 SQL_TYPE_INT32 = 3,
00040 SQL_TYPE_INT64 = 4,
00041 SQL_TYPE_DECIMAL = 5,
00042 SQL_TYPE_FLOAT32 = 6,
00043 SQL_TYPE_FLOAT64 = 7,
00044 SQL_TYPE_FLAG = 8,
00045 SQL_TYPE_TIMESTAMP = 9,
00046 SQL_TYPE_DATE = 10,
00047 SQL_TYPE_DATETIME = 11,
00048 SQL_TYPE_CHAR = 12,
00049 SQL_TYPE_VARCHAR = 13,
00050 SQL_TYPE_BLOB = 14
00051 };
00052 };
00053
00054 class DataColumn;
00055 typedef RefCountPtr<DataColumn> DataColumnPtr;
00056
00057 class DataColumn : public IMemoryValidate
00058 {
00059 private:
00060 String m_name;
00061 int m_colType;
00062 int m_dataLen;
00063 int m_index;
00064
00065 public:
00066 DataColumn();
00067 DataColumn(const DataColumn& col);
00068 DataColumn(const String& name, int index = 0, int colType = DbSqlType::SQL_TYPE_UNASSIGNED, int dataLen = 0);
00069 virtual ~DataColumn();
00070
00071 DataColumn& operator =(const DataColumn& col);
00072
00073 inline String& Name() { return m_name; }
00074 inline int& Type() { return m_colType; }
00075 inline int& Length() { return m_dataLen; }
00076 inline int& Index() { return m_index; }
00077
00078 DataColumnPtr Clone() const;
00079
00080 #if defined(DEBUG)
00081 virtual void CheckMem() const;
00082 virtual void ValidateMem() const;
00083 #endif
00084 };
00085
00088 #endif