diff options
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sql/field.h b/sql/field.h index 8bd7343931b..a1fae26dfcc 100644 --- a/sql/field.h +++ b/sql/field.h @@ -464,6 +464,7 @@ inline bool is_temporal_type_with_date(enum_field_types type) case MYSQL_TYPE_DATETIME2: case MYSQL_TYPE_TIMESTAMP2: DBUG_ASSERT(0); // field->real_type() should not get to here. + return false; default: return false; } @@ -781,6 +782,11 @@ public: @retval false - conversion is needed */ virtual bool memcpy_field_possible(const Field *from) const= 0; + virtual bool make_empty_rec_store_default_value(THD *thd, Item *item); + virtual void make_empty_rec_reset(THD *thd) + { + reset(); + } virtual int store(const char *to, size_t length,CHARSET_INFO *cs)=0; virtual int store_hex_hybrid(const char *str, size_t length); virtual int store(double nr)=0; @@ -1504,7 +1510,7 @@ public: of a table is compatible with the old definition so that it can determine if data needs to be copied over (table data change). */ - virtual uint is_equal(Create_field *new_field); + virtual uint is_equal(Create_field *new_field)= 0; /* convert decimal to longlong with overflow check */ longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag, int *err); @@ -1868,7 +1874,6 @@ public: my_decimal *val_decimal(my_decimal *); bool val_bool() { return val_real() != 0e0; } virtual bool str_needs_quotes() { return TRUE; } - uint is_equal(Create_field *new_field); bool eq_cmp_as_binary() { return MY_TEST(flags & BINARY_FLAG); } virtual uint length_size() { return 0; } double pos_in_interval(Field *min, Field *max) @@ -2640,6 +2645,7 @@ public: my_decimal *val_decimal(my_decimal *) { return 0; } String *val_str(String *value,String *value2) { value2->length(0); return value2;} + uint is_equal(Create_field *new_field); int cmp(const uchar *a, const uchar *b) { return 0;} void sort_string(uchar *buff, uint length) {} uint32 pack_length() const { return 0; } @@ -3563,6 +3569,7 @@ public: int cmp(const uchar *,const uchar *); void sort_string(uchar *buff,uint length); void sql_type(String &str) const; + uint is_equal(Create_field *new_field); virtual uchar *pack(uchar *to, const uchar *from, uint max_length); virtual const uchar *unpack(uchar* to, const uchar *from, @@ -3893,6 +3900,7 @@ public: !compression_method() == !from->compression_method() && !table->copy_blobs; } + bool make_empty_rec_store_default_value(THD *thd, Item *item); int store(const char *to, size_t length, CHARSET_INFO *charset); using Field_str::store; double val_real(void); @@ -4210,6 +4218,16 @@ public: return save_in_field_str(to); } bool memcpy_field_possible(const Field *from) const { return false; } + void make_empty_rec_reset(THD *thd) + { + if (flags & NOT_NULL_FLAG) + { + set_notnull(); + store((longlong) 1, true); + } + else + reset(); + } int store(const char *to,size_t length,CHARSET_INFO *charset); int store(double nr); int store(longlong nr, bool unsigned_val); @@ -4276,6 +4294,11 @@ public: { flags=(flags & ~ENUM_FLAG) | SET_FLAG; } + void make_empty_rec_reset(THD *thd) + { + Field::make_empty_rec_reset(thd); + } + int store_field(Field *from) { return from->save_in_field(this); } int store(const char *to,size_t length,CHARSET_INFO *charset); int store(double nr) { return Field_set::store((longlong) nr, FALSE); } |