103
103
const char *field_name_arg);
104
104
virtual ~Field() {}
105
105
/* Store functions returns 1 on overflow and -1 on fatal error */
106
virtual int store(const char *to, uint length,CHARSET_INFO *cs)=0;
106
virtual int store(const char *to, uint length, const CHARSET_INFO * const cs)=0;
107
107
virtual int store(double nr)=0;
108
108
virtual int store(int64_t nr, bool unsigned_val)=0;
109
109
virtual int store_decimal(const my_decimal *d)=0;
110
110
virtual int store_time(DRIZZLE_TIME *ltime, timestamp_type t_type);
111
int store(const char *to, uint length, CHARSET_INFO *cs,
111
int store(const char *to, uint length, const CHARSET_INFO * const cs,
112
112
enum_check_fields check_level);
113
113
virtual double val_real(void)=0;
114
114
virtual int64_t val_int(void)=0;
319
319
null_ptr=ADD_TO_PTR(null_ptr,ptr_diff,uchar*);
321
321
virtual void get_image(uchar *buff, uint length,
322
CHARSET_INFO *cs __attribute__((unused)))
322
const CHARSET_INFO * const cs __attribute__((unused)))
323
323
{ memcpy(buff,ptr,length); }
324
324
virtual void set_image(const uchar *buff,uint length,
325
CHARSET_INFO *cs __attribute__((unused)))
325
const CHARSET_INFO * const cs __attribute__((unused)))
326
326
{ memcpy(ptr,buff,length); }
445
445
uint fill_cache_field(struct st_cache_field *copy);
446
446
virtual bool get_date(DRIZZLE_TIME *ltime,uint fuzzydate);
447
447
virtual bool get_time(DRIZZLE_TIME *ltime);
448
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
449
virtual CHARSET_INFO *sort_charset(void) const { return charset(); }
448
virtual const CHARSET_INFO *charset(void) const { return &my_charset_bin; }
449
virtual const CHARSET_INFO *sort_charset(void) const { return charset(); }
450
450
virtual bool has_charset(void) const { return false; }
451
virtual void set_charset(CHARSET_INFO *charset_arg __attribute__((unused)))
451
virtual void set_charset(const CHARSET_INFO * const charset_arg __attribute__((unused)))
453
453
virtual enum Derivation derivation(void) const
454
454
{ return DERIVATION_IMPLICIT; }
560
560
int store_decimal(const my_decimal *);
561
561
my_decimal *val_decimal(my_decimal *);
562
562
uint is_equal(Create_field *new_field);
563
int check_int(CHARSET_INFO *cs, const char *str, int length,
563
int check_int(const CHARSET_INFO * const cs, const char *str, int length,
564
564
const char *int_end, int error);
565
bool get_int(CHARSET_INFO *cs, const char *from, uint len,
565
bool get_int(const CHARSET_INFO * const cs, const char *from, uint len,
566
566
int64_t *rnd, uint64_t unsigned_max,
567
567
int64_t signed_min, int64_t signed_max);
572
572
class Field_str :public Field {
574
CHARSET_INFO *field_charset;
574
const CHARSET_INFO *field_charset;
575
575
enum Derivation field_derivation;
577
577
Field_str(uchar *ptr_arg,uint32_t len_arg, uchar *null_ptr_arg,
578
578
uchar null_bit_arg, utype unireg_check_arg,
579
const char *field_name_arg, CHARSET_INFO *charset);
579
const char *field_name_arg, const CHARSET_INFO * const charset);
580
580
Item_result result_type () const { return STRING_RESULT; }
581
581
uint decimals() const { return NOT_FIXED_DEC; }
582
582
int store(double nr);
583
583
int store(int64_t nr, bool unsigned_val)=0;
584
584
int store_decimal(const my_decimal *);
585
int store(const char *to,uint length,CHARSET_INFO *cs)=0;
585
int store(const char *to,uint length, const CHARSET_INFO * const cs)=0;
586
586
uint size_of() const { return sizeof(*this); }
587
CHARSET_INFO *charset(void) const { return field_charset; }
588
void set_charset(CHARSET_INFO *charset_arg) { field_charset= charset_arg; }
587
const CHARSET_INFO *charset(void) const { return field_charset; }
588
void set_charset(const CHARSET_INFO * const charset_arg) { field_charset= charset_arg; }
589
589
enum Derivation derivation(void) const { return field_derivation; }
590
590
virtual void set_derivation(enum Derivation derivation_arg)
591
591
{ field_derivation= derivation_arg; }
609
609
Field_longstr(uchar *ptr_arg, uint32_t len_arg, uchar *null_ptr_arg,
610
610
uchar null_bit_arg, utype unireg_check_arg,
611
const char *field_name_arg, CHARSET_INFO *charset_arg)
611
const char *field_name_arg, const CHARSET_INFO * const charset_arg)
612
612
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
613
613
field_name_arg, charset_arg)
656
656
enum_field_types type() const { return DRIZZLE_TYPE_TINY;}
657
657
enum ha_base_keytype key_type() const
658
658
{ return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
659
int store(const char *to,uint length,CHARSET_INFO *charset);
659
int store(const char *to,uint length, const CHARSET_INFO * const charset);
660
660
int store(double nr);
661
661
int store(int64_t nr, bool unsigned_val);
662
662
int reset(void) { ptr[0]=0; return 0; }
698
698
enum utype unireg_check_arg, const char *field_name_arg,
699
699
uint packlength_arg,
700
700
TYPELIB *typelib_arg,
701
CHARSET_INFO *charset_arg)
701
const CHARSET_INFO * const charset_arg)
702
702
:Field_str(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
703
703
unireg_check_arg, field_name_arg, charset_arg),
704
704
packlength(packlength_arg),typelib(typelib_arg)
710
710
enum Item_result cmp_type () const { return INT_RESULT; }
711
711
enum Item_result cast_to_int_type () const { return INT_RESULT; }
712
712
enum ha_base_keytype key_type() const;
713
int store(const char *to,uint length,CHARSET_INFO *charset);
713
int store(const char *to,uint length, const CHARSET_INFO * const charset);
714
714
int store(double nr);
715
715
int store(int64_t nr, bool unsigned_val);
716
716
double val_real(void);
733
733
bool eq_def(Field *field);
734
734
bool has_charset(void) const { return true; }
735
735
/* enum and set are sorted as integers */
736
CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
736
const CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
738
738
int do_save_field_metadata(uchar *first_byte);
767
767
TYPELIB *save_interval; // Temporary copy for the above
768
768
// Used only for UCS2 intervals
769
769
List<String> interval_list;
770
CHARSET_INFO *charset;
770
const CHARSET_INFO *charset;
771
771
Field *field; // For alter table
773
773
uint8_t row,col,sc_length,interval_id; // For rea_create_table
793
793
bool init(THD *thd, char *field_name, enum_field_types type, char *length,
794
794
char *decimals, uint type_modifier, Item *default_value,
795
795
Item *on_update_value, LEX_STRING *comment, char *change,
796
List<String> *interval_list, CHARSET_INFO *cs,
796
List<String> *interval_list, const CHARSET_INFO * const cs,
797
797
uint uint_geom_type,
798
798
enum column_format_type column_format);
847
847
Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32_t field_length,
848
848
uchar *null_pos, uchar null_bit,
849
849
uint pack_flag, enum_field_types field_type,
850
const CHARSET_INFO * cs,
851
851
Field::utype unireg_check,
852
852
TYPELIB *interval, const char *field_name);
853
853
uint pack_length_to_packflag(uint type);