49
49
void operator=(Field &);
51
51
static void *operator new(size_t size) {return sql_alloc(size); }
52
static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); }
52
static void operator delete(void *ptr_arg __attribute__((__unused__)),
53
size_t size __attribute__((__unused__)))
54
{ TRASH(ptr_arg, size); }
54
56
uchar *ptr; // Position to field in record
55
57
uchar *null_ptr; // Byte where null_bit is
213
215
virtual enum_field_types type() const =0;
214
216
virtual enum_field_types real_type() const { return type(); }
215
217
inline int cmp(const uchar *str) { return cmp(ptr,str); }
216
virtual int cmp_max(const uchar *a, const uchar *b, uint max_len)
218
virtual int cmp_max(const uchar *a, const uchar *b,
219
uint max_len __attribute__((__unused__)))
217
220
{ return cmp(a, b); }
218
221
virtual int cmp(const uchar *,const uchar *)=0;
219
virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L)
222
virtual int cmp_binary(const uchar *a,const uchar *b,
223
uint32 __attribute__((__unused__)) max_length=~0)
220
224
{ return memcmp(a,b,pack_length()); }
221
225
virtual int cmp_offset(uint row_offset)
222
226
{ return cmp(ptr,ptr+row_offset); }
224
228
{ return cmp_binary(ptr, ptr+row_offset); };
225
229
virtual int key_cmp(const uchar *a,const uchar *b)
226
230
{ return cmp(a, b); }
227
virtual int key_cmp(const uchar *str, uint length)
231
virtual int key_cmp(const uchar *str, uint length __attribute__((__unused__)))
228
232
{ return cmp(ptr,str); }
229
233
virtual uint decimals() const { return 0; }
314
318
null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*);
316
virtual void get_image(uchar *buff, uint length, CHARSET_INFO *cs)
320
virtual void get_image(uchar *buff, uint length,
321
CHARSET_INFO *cs __attribute__((__unused__)))
317
322
{ memcpy(buff,ptr,length); }
318
virtual void set_image(const uchar *buff,uint length, CHARSET_INFO *cs)
323
virtual void set_image(const uchar *buff,uint length,
324
CHARSET_INFO *cs __attribute__((__unused__)))
319
325
{ memcpy(ptr,buff,length); }
345
351
Number of copied bytes (excluding padded zero bytes -- see above).
348
virtual uint get_key_image(uchar *buff, uint length, imagetype type)
354
virtual uint get_key_image(uchar *buff, uint length,
355
imagetype type __attribute__((__unused__)))
350
357
get_image(buff, length, &my_charset_bin);
418
425
return unpack(to, from, max_length, low_byte_first);
420
virtual uint packed_col_length(const uchar *to, uint length)
427
virtual uint packed_col_length(const uchar *to __attribute__((__unused__)),
421
429
{ return length;}
422
430
virtual uint max_packed_col_length(uint max_length)
423
431
{ return max_length;}
425
virtual int pack_cmp(const uchar *a,const uchar *b, uint key_length_arg,
426
my_bool insert_or_update)
433
virtual int pack_cmp(const uchar *a,const uchar *b,
434
uint key_length_arg __attribute__((__unused__)),
435
my_bool insert_or_update __attribute__((__unused__)))
427
436
{ return cmp(a,b); }
428
virtual int pack_cmp(const uchar *b, uint key_length_arg,
429
my_bool insert_or_update)
437
virtual int pack_cmp(const uchar *b,
438
uint key_length_arg __attribute__((__unused__)),
439
my_bool insert_or_update __attribute__((__unused__)))
430
440
{ return cmp(ptr,b); }
431
441
uint offset(uchar *record)
439
449
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
440
450
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
441
451
virtual bool has_charset(void) const { return FALSE; }
442
virtual void set_charset(CHARSET_INFO *charset_arg) { }
452
virtual void set_charset(CHARSET_INFO *charset_arg __attribute__((__unused__)))
443
454
virtual enum Derivation derivation(void) const
444
455
{ return DERIVATION_IMPLICIT; }
445
virtual void set_derivation(enum Derivation derivation_arg) { }
456
virtual void set_derivation(enum Derivation derivation_arg __attribute__((__unused__)))
446
458
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
447
459
int cuted_increment);
448
460
void set_datetime_warning(MYSQL_ERROR::enum_warning_level, uint code,
773
785
uint32 max_display_length() { return 4; }
775
787
virtual uchar *pack(uchar* to, const uchar *from,
776
uint max_length, bool low_byte_first)
788
uint max_length __attribute__((__unused__)),
789
bool low_byte_first __attribute__((__unused__)))
782
795
virtual const uchar *unpack(uchar* to, const uchar *from,
783
uint param_data, bool low_byte_first)
796
uint param_data __attribute__((__unused__)),
797
bool low_byte_first __attribute__((__unused__)))
822
836
uint32 max_display_length() { return 6; }
824
838
virtual uchar *pack(uchar* to, const uchar *from,
825
uint max_length, bool low_byte_first)
839
uint max_length __attribute__((__unused__)),
840
bool low_byte_first __attribute__((__unused__)))
828
843
#ifdef WORDS_BIGENDIAN
844
859
virtual const uchar *unpack(uchar* to, const uchar *from,
845
uint param_data, bool low_byte_first)
860
uint param_data __attribute__((__unused__)),
861
bool low_byte_first __attribute__((__unused__)))
848
864
#ifdef WORDS_BIGENDIAN
937
953
void sql_type(String &str) const;
938
954
uint32 max_display_length() { return MY_INT32_NUM_DECIMAL_DIGITS; }
939
955
virtual uchar *pack(uchar* to, const uchar *from,
940
uint max_length, bool low_byte_first)
956
uint max_length __attribute__((__unused__)),
957
bool low_byte_first __attribute__((__unused__)))
943
960
#ifdef WORDS_BIGENDIAN
959
976
virtual const uchar *unpack(uchar* to, const uchar *from,
960
uint param_data, bool low_byte_first)
977
uint param_data __attribute__((__unused__)),
978
bool low_byte_first __attribute__((__unused__)))
963
981
#ifdef WORDS_BIGENDIAN
1017
1035
bool can_be_compared_as_longlong() const { return TRUE; }
1018
1036
uint32 max_display_length() { return 20; }
1019
1037
virtual uchar *pack(uchar* to, const uchar *from,
1020
uint max_length, bool low_byte_first)
1038
uint max_length __attribute__((__unused__)),
1039
bool low_byte_first __attribute__((__unused__)))
1023
1042
#ifdef WORDS_BIGENDIAN
1039
1058
virtual const uchar *unpack(uchar* to, const uchar *from,
1040
uint param_data, bool low_byte_first)
1059
uint param_data __attribute__((__unused__)),
1060
bool low_byte_first __attribute__((__unused__)))
1043
1063
#ifdef WORDS_BIGENDIAN
1144
1164
unireg_check_arg, field_name_arg, cs)
1146
1166
enum_field_types type() const { return MYSQL_TYPE_NULL;}
1147
int store(const char *to, uint length, CHARSET_INFO *cs)
1148
{ null[0]=1; return 0; }
1149
int store(double nr) { null[0]=1; return 0; }
1150
int store(longlong nr, bool unsigned_val) { null[0]=1; return 0; }
1151
int store_decimal(const my_decimal *d) { null[0]=1; return 0; }
1152
int reset(void) { return 0; }
1153
double val_real(void) { return 0.0;}
1154
longlong val_int(void) { return 0;}
1167
int store(const char *to __attribute__((__unused__)),
1168
uint length __attribute__((__unused__)),
1169
CHARSET_INFO *cs __attribute__((__unused__)))
1170
{ null[0]=1; return 0; }
1171
int store(double nr __attribute__((__unused__)))
1172
{ null[0]=1; return 0; }
1173
int store(longlong nr __attribute__((__unused__)),
1174
bool unsigned_val __attribute__((__unused__)))
1175
{ null[0]=1; return 0; }
1176
int store_decimal(const my_decimal *d __attribute__((__unused__)))
1177
{ null[0]=1; return 0; }
1180
double val_real(void)
1182
longlong val_int(void)
1155
1184
my_decimal *val_decimal(my_decimal *) { return 0; }
1156
String *val_str(String *value,String *value2)
1185
String *val_str(String *value __attribute__((__unused__)),
1157
1187
{ value2->length(0); return value2;}
1158
int cmp(const uchar *a, const uchar *b) { return 0;}
1159
void sort_string(uchar *buff, uint length) {}
1188
int cmp(const uchar *a __attribute__((__unused__)),
1189
const uchar *b __attribute__((__unused__))) { return 0;}
1190
void sort_string(uchar *buff __attribute__((__unused__)),
1191
uint length __attribute__((__unused__))) {}
1160
1192
uint32 pack_length() const { return 0; }
1161
1193
void sql_type(String &str) const;
1162
1194
uint size_of() const { return sizeof(*this); }
1763
1795
{ return (field_metadata & 0x00ff); }
1764
1796
uint row_pack_length() { return pack_length(); }
1765
1797
virtual bool zero_pack() const { return 0; }
1766
bool optimize_range(uint idx, uint part) { return 0; }
1798
bool optimize_range(uint idx __attribute__((__unused__)),
1799
uint part __attribute__((__unused__)))
1767
1801
bool eq_def(Field *field);
1768
1802
bool has_charset(void) const { return TRUE; }
1769
1803
/* enum and set are sorted as integers */
1840
1874
virtual bool str_needs_quotes() { return TRUE; }
1841
1875
my_decimal *val_decimal(my_decimal *);
1842
1876
int cmp(const uchar *a, const uchar *b)
1844
DBUG_ASSERT(ptr == a);
1845
1879
return Field_bit::key_cmp(b, bytes_in_rec+test(bit_len));
1847
1881
int cmp_binary_offset(uint row_offset)
1851
1885
{ return cmp_binary((uchar *) a, (uchar *) b); }
1852
1886
int key_cmp(const uchar *str, uint length);
1853
1887
int cmp_offset(uint row_offset);
1854
void get_image(uchar *buff, uint length, CHARSET_INFO *cs)
1855
{ get_key_image(buff, length, itRAW); }
1888
void get_image(uchar *buff, uint length,
1889
CHARSET_INFO *cs __attribute__((__unused__)))
1890
{ get_key_image(buff, length, itRAW); }
1856
1891
void set_image(const uchar *buff,uint length, CHARSET_INFO *cs)
1857
1892
{ Field_bit::store((char *) buff, length, cs); }
1858
1893
uint get_key_image(uchar *buff, uint length, imagetype type);