diff options
Diffstat (limited to 'sql/item_func.h')
-rw-r--r-- | sql/item_func.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/item_func.h b/sql/item_func.h index ab6ec706248..bdf91810d81 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -552,12 +552,18 @@ public: class Item_func_signed :public Item_int_func { public: - Item_func_signed(Item *a) :Item_int_func(a) {} + Item_func_signed(Item *a) :Item_int_func(a) + { + unsigned_flag= 0; + } const char *func_name() const { return "cast_as_signed"; } longlong val_int(); longlong val_int_from_str(int *error); void fix_length_and_dec() - { fix_char_length(args[0]->max_char_length()); unsigned_flag=0; } + { + fix_char_length(min(args[0]->max_char_length(), + MY_INT64_NUM_DECIMAL_DIGITS)); + } virtual void print(String *str, enum_query_type query_type); uint decimal_precision() const { return args[0]->decimal_precision(); } }; @@ -566,14 +572,11 @@ public: class Item_func_unsigned :public Item_func_signed { public: - Item_func_unsigned(Item *a) :Item_func_signed(a) {} - const char *func_name() const { return "cast_as_unsigned"; } - void fix_length_and_dec() + Item_func_unsigned(Item *a) :Item_func_signed(a) { - fix_char_length(min(args[0]->max_char_length(), - DECIMAL_MAX_PRECISION + 2)); - unsigned_flag=1; + unsigned_flag= 1; } + const char *func_name() const { return "cast_as_unsigned"; } longlong val_int(); virtual void print(String *str, enum_query_type query_type); }; |