00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __XVR2_SQL_FIELD_H__
00015 #define __XVR2_SQL_FIELD_H__
00016
00017 #include<xvr2/xvr2config.h>
00018 #include<xvr2/Date.h>
00019 #include<xvr2/Time.h>
00020 #include<xvr2/Timestamp.h>
00021 #include<xvr2/Byte.h>
00022 #include<xvr2/String.h>
00023 #include<xvr2/CoreExceptions.h>
00024 #include<xvr2/SQL/Driver.h>
00025
00026 namespace xvr2{
00027 namespace SQL {
00036 class Field:public Object{
00037 private:
00038 void *dataPtr;
00039 UInt32 dataLen;
00040 int dataType;
00041
00042 char *tmpStrTINYINT;
00043 char *tmpStrINTEGER;
00044 char *tmpStrBIGINT;
00045 char *tmpStrFLOAT;
00046 char *tmpStrDOUBLE;
00047 char *tmpStrBIT;
00048 char *tmpStrBYTE;
00049
00050 String tmpString;
00051
00052
00053
00054
00055
00056
00057
00058
00059 Date *tmpDate;
00060 Time *tmpTime;
00061 Timestamp *tmpTimestamp;
00062 Byte *tmpByte;
00063 bool *tmpBool;
00064 Int16 *tmpInt16;
00065 Int32 *tmpInt32;
00066 Int64 *tmpInt64;
00067 float *tmpFloat;
00068 double *tmpDouble;
00069 String colname;
00070 public:
00071 Driver *drv;
00075 enum SQLtypes{
00077 TINYINT = 1,
00079 INTEGER = 2,
00082 BIGINT = 3,
00084 FLOAT = 4,
00086 DOUBLE = 5,
00089 CHAR = 6,
00092 VARCHAR = 7,
00095 STRING = 8,
00103 BLOB = 9,
00108 TEXT = 10,
00111 DATE = 11,
00114 TIME = 12,
00117 TIMESTAMP = 13,
00121 BIT = 14,
00123 BYTE = 15
00124 };
00126 Field();
00132 Field(const void *data, const UInt32 size);
00137 Field(const int type, const void *data, const UInt32 size);
00142 void init(const int type, const void *data, const UInt32 size);
00143
00144
00145
00148 ~Field();
00164 Int16 toTinyInt() const;
00167 UInt16 toUTinyInt() const;
00176 Int32 toInteger() const;
00179 UInt32 toUInteger() const;
00188 Int64 toBigInt() const;
00192 UInt64 toUBigInt() const;
00203 float toFloat() const;
00214 double toDouble() const;
00217 char *toChar() const;
00221 std::string toString() const;
00225 const String &toText() const;
00230 const void *toBLOB();
00233 const Date *toDate();
00236 const Time *toTime();
00239 Timestamp toTimestamp();
00240 Timestamp toTimestamp() const;
00243 bool toBit() const;
00246 bool toBool() const;
00249 const Byte *toByte();
00252 const int getDatatype();
00255 const int getDatatype() const;
00258 const UInt32 size();
00261 const UInt32 size() const;
00264 const UInt32 dataSize();
00267 const UInt32 dataSize() const;
00269 void setFieldName(const String &nam);
00272 const String &getFieldName() const;
00273 bool isNull() const;
00274 };
00275 };
00276 };
00277
00278 #endif