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 __attribute__((__unused__)),
53
size_t size __attribute__((__unused__)))
54
{ TRASH(ptr_arg, size); }
52
static void operator delete(void *ptr_arg, size_t size) { TRASH(ptr_arg, size); }
56
54
uchar *ptr; // Position to field in record
57
55
uchar *null_ptr; // Byte where null_bit is
215
213
virtual enum_field_types type() const =0;
216
214
virtual enum_field_types real_type() const { return type(); }
217
215
inline int cmp(const uchar *str) { return cmp(ptr,str); }
218
virtual int cmp_max(const uchar *a, const uchar *b,
219
uint max_len __attribute__((__unused__)))
216
virtual int cmp_max(const uchar *a, const uchar *b, uint max_len)
220
217
{ return cmp(a, b); }
221
218
virtual int cmp(const uchar *,const uchar *)=0;
222
virtual int cmp_binary(const uchar *a,const uchar *b,
223
uint32 __attribute__((__unused__)) max_length=~0)
219
virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0L)
224
220
{ return memcmp(a,b,pack_length()); }
225
221
virtual int cmp_offset(uint row_offset)
226
222
{ return cmp(ptr,ptr+row_offset); }
228
224
{ return cmp_binary(ptr, ptr+row_offset); };
229
225
virtual int key_cmp(const uchar *a,const uchar *b)
230
226
{ return cmp(a, b); }
231
virtual int key_cmp(const uchar *str, uint length __attribute__((__unused__)))
227
virtual int key_cmp(const uchar *str, uint length)
232
228
{ return cmp(ptr,str); }
233
229
virtual uint decimals() const { return 0; }
318
314
null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*);
320
virtual void get_image(uchar *buff, uint length,
321
CHARSET_INFO *cs __attribute__((__unused__)))
316
virtual void get_image(uchar *buff, uint length, CHARSET_INFO *cs)
322
317
{ memcpy(buff,ptr,length); }
323
virtual void set_image(const uchar *buff,uint length,
324
CHARSET_INFO *cs __attribute__((__unused__)))
318
virtual void set_image(const uchar *buff,uint length, CHARSET_INFO *cs)
325
319
{ memcpy(ptr,buff,length); }
351
345
Number of copied bytes (excluding padded zero bytes -- see above).
354
virtual uint get_key_image(uchar *buff, uint length,
355
imagetype type __attribute__((__unused__)))
348
virtual uint get_key_image(uchar *buff, uint length, imagetype type)
357
350
get_image(buff, length, &my_charset_bin);
425
418
return unpack(to, from, max_length, low_byte_first);
427
virtual uint packed_col_length(const uchar *to __attribute__((__unused__)),
420
virtual uint packed_col_length(const uchar *to, uint length)
429
421
{ return length;}
430
422
virtual uint max_packed_col_length(uint max_length)
431
423
{ return max_length;}
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__)))
425
virtual int pack_cmp(const uchar *a,const uchar *b, uint key_length_arg,
426
my_bool insert_or_update)
436
427
{ return cmp(a,b); }
437
virtual int pack_cmp(const uchar *b,
438
uint key_length_arg __attribute__((__unused__)),
439
my_bool insert_or_update __attribute__((__unused__)))
428
virtual int pack_cmp(const uchar *b, uint key_length_arg,
429
my_bool insert_or_update)
440
430
{ return cmp(ptr,b); }
441
431
uint offset(uchar *record)
449
439
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
450
440
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
451
441
virtual bool has_charset(void) const { return FALSE; }
452
virtual void set_charset(CHARSET_INFO *charset_arg __attribute__((__unused__)))
442
virtual void set_charset(CHARSET_INFO *charset_arg) { }
454
443
virtual enum Derivation derivation(void) const
455
444
{ return DERIVATION_IMPLICIT; }
456
virtual void set_derivation(enum Derivation derivation_arg __attribute__((__unused__)))
445
virtual void set_derivation(enum Derivation derivation_arg) { }
458
446
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
459
447
int cuted_increment);
460
448
void set_datetime_warning(MYSQL_ERROR::enum_warning_level, uint code,
785
773
uint32 max_display_length() { return 4; }
787
775
virtual uchar *pack(uchar* to, const uchar *from,
788
uint max_length __attribute__((__unused__)),
789
bool low_byte_first __attribute__((__unused__)))
776
uint max_length, bool low_byte_first)
795
782
virtual const uchar *unpack(uchar* to, const uchar *from,
796
uint param_data __attribute__((__unused__)),
797
bool low_byte_first __attribute__((__unused__)))
783
uint param_data, bool low_byte_first)
836
822
uint32 max_display_length() { return 6; }
838
824
virtual uchar *pack(uchar* to, const uchar *from,
839
uint max_length __attribute__((__unused__)),
840
bool low_byte_first __attribute__((__unused__)))
825
uint max_length, bool low_byte_first)
843
828
#ifdef WORDS_BIGENDIAN
859
844
virtual const uchar *unpack(uchar* to, const uchar *from,
860
uint param_data __attribute__((__unused__)),
861
bool low_byte_first __attribute__((__unused__)))
845
uint param_data, bool low_byte_first)
864
848
#ifdef WORDS_BIGENDIAN
953
937
void sql_type(String &str) const;
954
938
uint32 max_display_length() { return MY_INT32_NUM_DECIMAL_DIGITS; }
955
939
virtual uchar *pack(uchar* to, const uchar *from,
956
uint max_length __attribute__((__unused__)),
957
bool low_byte_first __attribute__((__unused__)))
940
uint max_length, bool low_byte_first)
960
943
#ifdef WORDS_BIGENDIAN
976
959
virtual const uchar *unpack(uchar* to, const uchar *from,
977
uint param_data __attribute__((__unused__)),
978
bool low_byte_first __attribute__((__unused__)))
960
uint param_data, bool low_byte_first)
981
963
#ifdef WORDS_BIGENDIAN
1035
1018
bool can_be_compared_as_longlong() const { return TRUE; }
1036
1019
uint32 max_display_length() { return 20; }
1037
1020
virtual uchar *pack(uchar* to, const uchar *from,
1038
uint max_length __attribute__((__unused__)),
1039
bool low_byte_first __attribute__((__unused__)))
1021
uint max_length, bool low_byte_first)
1042
1024
#ifdef WORDS_BIGENDIAN
1058
1040
virtual const uchar *unpack(uchar* to, const uchar *from,
1059
uint param_data __attribute__((__unused__)),
1060
bool low_byte_first __attribute__((__unused__)))
1041
uint param_data, bool low_byte_first)
1063
1044
#ifdef WORDS_BIGENDIAN
1164
1147
unireg_check_arg, field_name_arg, cs)
1166
1149
enum_field_types type() const { return MYSQL_TYPE_NULL;}
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)
1150
int store(const char *to, uint length, CHARSET_INFO *cs)
1151
{ null[0]=1; return 0; }
1152
int store(double nr) { null[0]=1; return 0; }
1153
int store(longlong nr, bool unsigned_val) { null[0]=1; return 0; }
1154
int store_decimal(const my_decimal *d) { null[0]=1; return 0; }
1155
int reset(void) { return 0; }
1156
double val_real(void) { return 0.0;}
1157
longlong val_int(void) { return 0;}
1184
1158
my_decimal *val_decimal(my_decimal *) { return 0; }
1185
String *val_str(String *value __attribute__((__unused__)),
1159
String *val_str(String *value,String *value2)
1187
1160
{ value2->length(0); return value2;}
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__))) {}
1161
int cmp(const uchar *a, const uchar *b) { return 0;}
1162
void sort_string(uchar *buff, uint length) {}
1192
1163
uint32 pack_length() const { return 0; }
1193
1164
void sql_type(String &str) const;
1194
1165
uint size_of() const { return sizeof(*this); }
1398
1369
:Field_str((uchar*) 0,19, maybe_null_arg ? (uchar*) "": 0,0,
1399
1370
NONE, field_name_arg, cs) {}
1400
1371
enum_field_types type() const { return MYSQL_TYPE_DATETIME;}
1372
#ifdef HAVE_LONG_LONG
1401
1373
enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONGLONG; }
1402
1375
enum Item_result cmp_type () const { return INT_RESULT; }
1403
1376
uint decimals() const { return DATETIME_DEC; }
1404
1377
int store(const char *to,uint length,CHARSET_INFO *charset);
1795
1768
{ return (field_metadata & 0x00ff); }
1796
1769
uint row_pack_length() { return pack_length(); }
1797
1770
virtual bool zero_pack() const { return 0; }
1798
bool optimize_range(uint idx __attribute__((__unused__)),
1799
uint part __attribute__((__unused__)))
1771
bool optimize_range(uint idx, uint part) { return 0; }
1801
1772
bool eq_def(Field *field);
1802
1773
bool has_charset(void) const { return TRUE; }
1803
1774
/* enum and set are sorted as integers */
1874
1845
virtual bool str_needs_quotes() { return TRUE; }
1875
1846
my_decimal *val_decimal(my_decimal *);
1876
1847
int cmp(const uchar *a, const uchar *b)
1849
DBUG_ASSERT(ptr == a);
1879
1850
return Field_bit::key_cmp(b, bytes_in_rec+test(bit_len));
1881
1852
int cmp_binary_offset(uint row_offset)
1885
1856
{ return cmp_binary((uchar *) a, (uchar *) b); }
1886
1857
int key_cmp(const uchar *str, uint length);
1887
1858
int cmp_offset(uint row_offset);
1888
void get_image(uchar *buff, uint length,
1889
CHARSET_INFO *cs __attribute__((__unused__)))
1890
{ get_key_image(buff, length, itRAW); }
1859
void get_image(uchar *buff, uint length, CHARSET_INFO *cs)
1860
{ get_key_image(buff, length, itRAW); }
1891
1861
void set_image(const uchar *buff,uint length, CHARSET_INFO *cs)
1892
1862
{ Field_bit::store((char *) buff, length, cs); }
1893
1863
uint get_key_image(uchar *buff, uint length, imagetype type);