diff options
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/sql/field.h b/sql/field.h index f27ed8b9394..441ff9079c1 100644 --- a/sql/field.h +++ b/sql/field.h @@ -98,7 +98,7 @@ public: virtual int store(double nr)=0; virtual int store(longlong nr, bool unsigned_val)=0; virtual int store_decimal(const my_decimal *d)=0; - virtual int store_time(TIME *ltime, timestamp_type t_type); + virtual int store_time(MYSQL_TIME *ltime, timestamp_type t_type); virtual double val_real(void)=0; virtual longlong val_int(void)=0; virtual my_decimal *val_decimal(my_decimal *); @@ -193,9 +193,9 @@ public: */ virtual void sql_type(String &str) const =0; virtual uint size_of() const =0; // For new field - inline bool is_null(uint row_offset=0) + inline bool is_null(my_ptrdiff_t row_offset= 0) { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : table->null_row; } - inline bool is_real_null(uint row_offset=0) + inline bool is_real_null(my_ptrdiff_t row_offset= 0) { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; } inline bool is_null_in_record(const uchar *record) { @@ -210,9 +210,9 @@ public: return 0; return test(null_ptr[offset] & null_bit); } - inline void set_null(int row_offset=0) + inline void set_null(my_ptrdiff_t row_offset= 0) { if (null_ptr) null_ptr[row_offset]|= null_bit; } - inline void set_notnull(int row_offset=0) + inline void set_notnull(my_ptrdiff_t row_offset= 0) { if (null_ptr) null_ptr[row_offset]&= (uchar) ~null_bit; } inline bool maybe_null(void) { return null_ptr != 0 || table->maybe_null; } inline bool real_maybe_null(void) { return null_ptr != 0; } @@ -347,8 +347,8 @@ public: } void copy_from_tmp(int offset); uint fill_cache_field(struct st_cache_field *copy); - virtual bool get_date(TIME *ltime,uint fuzzydate); - virtual bool get_time(TIME *ltime); + virtual bool get_date(MYSQL_TIME *ltime,uint fuzzydate); + virtual bool get_time(MYSQL_TIME *ltime); virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; } virtual CHARSET_INFO *sort_charset(void) const { return charset(); } virtual bool has_charset(void) const { return FALSE; } @@ -358,8 +358,6 @@ public: virtual void set_derivation(enum Derivation derivation_arg) { } bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code, int cuted_increment); - bool check_int(const char *str, int length, const char *int_end, - CHARSET_INFO *cs); void set_datetime_warning(MYSQL_ERROR::enum_warning_level, uint code, const char *str, uint str_len, timestamp_type ts_type, int cuted_increment); @@ -445,6 +443,11 @@ public: int store_decimal(const my_decimal *); my_decimal *val_decimal(my_decimal *); uint is_equal(create_field *new_field); + int check_int(CHARSET_INFO *cs, const char *str, int length, + const char *int_end, int error); + bool get_int(CHARSET_INFO *cs, const char *from, uint len, + longlong *rnd, ulonglong unsigned_max, + longlong signed_min, longlong signed_max); }; @@ -504,6 +507,7 @@ public: {} int store_decimal(const my_decimal *); my_decimal *val_decimal(my_decimal *); + uint32 max_display_length() { return field_length; } }; @@ -532,7 +536,6 @@ public: void overflow(bool negative); bool zero_pack() const { return 0; } void sql_type(String &str) const; - uint32 max_display_length() { return field_length; } }; @@ -564,7 +567,7 @@ public: int store(const char *to, uint length, CHARSET_INFO *charset); int store(double nr); int store(longlong nr, bool unsigned_val); - int store_time(TIME *ltime, timestamp_type t_type); + int store_time(MYSQL_TIME *ltime, timestamp_type t_type); int store_decimal(const my_decimal *); double val_real(void); longlong val_int(void); @@ -783,7 +786,6 @@ public: void sort_string(char *buff,uint length); uint32 pack_length() const { return sizeof(float); } void sql_type(String &str) const; - uint32 max_display_length() { return 24; } }; @@ -825,7 +827,6 @@ public: void sort_string(char *buff,uint length); uint32 pack_length() const { return sizeof(double); } void sql_type(String &str) const; - uint32 max_display_length() { return 53; } uint size_of() const { return sizeof(*this); } }; @@ -909,8 +910,8 @@ public: longget(tmp,ptr); return tmp; } - bool get_date(TIME *ltime,uint fuzzydate); - bool get_time(TIME *ltime); + bool get_date(MYSQL_TIME *ltime,uint fuzzydate); + bool get_time(MYSQL_TIME *ltime); timestamp_auto_set_type get_auto_set_type() const; }; @@ -983,7 +984,7 @@ public: int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); int store(longlong nr, bool unsigned_val); - int store_time(TIME *ltime, timestamp_type type); + int store_time(MYSQL_TIME *ltime, timestamp_type type); int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; } double val_real(void); longlong val_int(void); @@ -995,8 +996,8 @@ public: void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } bool zero_pack() const { return 1; } - bool get_date(TIME *ltime,uint fuzzydate); - bool get_time(TIME *ltime); + bool get_date(MYSQL_TIME *ltime,uint fuzzydate); + bool get_time(MYSQL_TIME *ltime); }; @@ -1015,7 +1016,7 @@ public: enum_field_types type() const { return MYSQL_TYPE_TIME;} enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; } enum Item_result cmp_type () const { return INT_RESULT; } - int store_time(TIME *ltime, timestamp_type type); + int store_time(MYSQL_TIME *ltime, timestamp_type type); int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); int store(longlong nr, bool unsigned_val); @@ -1023,9 +1024,9 @@ public: double val_real(void); longlong val_int(void); String *val_str(String*,String *); - bool get_date(TIME *ltime, uint fuzzydate); + bool get_date(MYSQL_TIME *ltime, uint fuzzydate); bool send_binary(Protocol *protocol); - bool get_time(TIME *ltime); + bool get_time(MYSQL_TIME *ltime); int cmp(const char *,const char*); void sort_string(char *buff,uint length); uint32 pack_length() const { return 3; } @@ -1056,7 +1057,7 @@ public: int store(const char *to,uint length,CHARSET_INFO *charset); int store(double nr); int store(longlong nr, bool unsigned_val); - int store_time(TIME *ltime, timestamp_type type); + int store_time(MYSQL_TIME *ltime, timestamp_type type); int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; @@ -1072,8 +1073,8 @@ public: void sql_type(String &str) const; bool can_be_compared_as_longlong() const { return TRUE; } bool zero_pack() const { return 1; } - bool get_date(TIME *ltime,uint fuzzydate); - bool get_time(TIME *ltime); + bool get_date(MYSQL_TIME *ltime,uint fuzzydate); + bool get_time(MYSQL_TIME *ltime); }; @@ -1355,7 +1356,7 @@ public: int store_decimal(const my_decimal *); void get_key_image(char *buff,uint length,imagetype type); uint size_of() const { return sizeof(*this); } - int reset(void) { return !maybe_null(); } + int reset(void) { return !maybe_null() || Field_blob::reset(); } }; #endif /*HAVE_SPATIAL*/ |