diff options
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/sql/field.h b/sql/field.h index a9b257f0c3a..422e91768e6 100644 --- a/sql/field.h +++ b/sql/field.h @@ -47,6 +47,9 @@ public: enum utype { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL, CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD, BIT_FIELD, TIMESTAMP_FIELD,CAPITALIZE,BLOB_FIELD}; + + enum imagetype { itRAW, itMBR}; + utype unireg_check; uint32 field_length; // Length of field uint16 flags; @@ -137,7 +140,7 @@ public: { memcpy(buff,ptr,length); } inline void set_image(char *buff,uint length) { memcpy(ptr,buff,length); } - virtual void get_key_image(char *buff,uint length) + virtual void get_key_image(char *buff,uint length, imagetype type) { get_image(buff,length); } virtual void set_key_image(char *buff,uint length) { set_image(buff,length); } @@ -825,6 +828,7 @@ class Field_blob :public Field_str { uint packlength; String value; // For temporaries bool binary_flag; + bool geom_flag; public: Field_blob(char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, @@ -834,7 +838,7 @@ public: struct st_table *table_arg, bool binary_arg) :Field_str((char*) 0,len_arg, maybe_null_arg ? (uchar*) "": 0,0, NONE, field_name_arg, table_arg), - packlength(3),binary_flag(binary_arg) + packlength(3),binary_flag(binary_arg), geom_flag(true) { flags|= BLOB_FLAG; if (binary_arg) @@ -881,7 +885,7 @@ public: store_length(length); memcpy_fixed(ptr+packlength,&data,sizeof(char*)); } - void get_key_image(char *buff,uint length); + void get_key_image(char *buff,uint length, imagetype type); void set_key_image(char *buff,uint length); void sql_type(String &str) const; inline bool copy() @@ -910,6 +914,25 @@ public: }; +class Field_geom :public Field_blob { +public: + Field_geom(char *ptr_arg, uchar *null_ptr_arg, uint null_bit_arg, + enum utype unireg_check_arg, const char *field_name_arg, + struct st_table *table_arg,uint blob_pack_length, + bool binary_arg) + :Field_blob(ptr_arg, null_ptr_arg, null_bit_arg, unireg_check_arg, + field_name_arg, table_arg, blob_pack_length,binary_arg) {} + Field_geom(uint32 len_arg,bool maybe_null_arg, const char *field_name_arg, + struct st_table *table_arg, bool binary_arg) + :Field_blob(len_arg, maybe_null_arg, field_name_arg, + table_arg, binary_arg) {} + enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY; } + + void get_key_image(char *buff,uint length, imagetype type); + void set_key_image(char *buff,uint length); +}; + + class Field_enum :public Field_str { protected: uint packlength; @@ -1059,6 +1082,8 @@ bool test_if_int(const char *str,int length); #define FIELDFLAG_INTERVAL 256 #define FIELDFLAG_BITFIELD 512 // mangled with dec! #define FIELDFLAG_BLOB 1024 // mangled with dec! +#define FIELDFLAG_GEOM 2048 + #define FIELDFLAG_LEFT_FULLSCREEN 8192 #define FIELDFLAG_RIGHT_FULLSCREEN 16384 #define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output @@ -1085,6 +1110,7 @@ bool test_if_int(const char *str,int length); #define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL) #define f_is_bitfield(x) ((x) & FIELDFLAG_BITFIELD) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) +#define f_is_geom(x) ((x) & FIELDFLAG_GEOM) #define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256)) #define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT) #define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL) |