summaryrefslogtreecommitdiff
path: root/sql/item_func.h
diff options
context:
space:
mode:
authorChaithra Gopalareddy <chaithra.gopalareddy@oracle.com>2013-01-31 06:39:15 +0530
committerChaithra Gopalareddy <chaithra.gopalareddy@oracle.com>2013-01-31 06:39:15 +0530
commite1ee9581cb4a4cac085d0ad6eedadb73de187deb (patch)
treef50d2fdba79278f7fee270e5969dcfb649fb9a24 /sql/item_func.h
parent7aa707f2334097d325738209e1fdbbd52a852e14 (diff)
downloadmariadb-git-e1ee9581cb4a4cac085d0ad6eedadb73de187deb.tar.gz
Bug#14096619: UNABLE TO RESTORE DATABASE DUMP
Backport of Bug#13581962 mysql-test/r/cast.result: Added test result for Bug#13581962,Bug#14096619 mysql-test/t/cast.test: Added test case for Bug#13581962,Bug#14096619 sql/item_func.h: limit max length by MY_INT64_NUM_DECIMAL_DIGITS
Diffstat (limited to 'sql/item_func.h')
-rw-r--r--sql/item_func.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/sql/item_func.h b/sql/item_func.h
index ec410ed3d3d..d769ceb0179 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -403,12 +403,17 @@ 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()
- { max_length=args[0]->max_length; unsigned_flag=0; }
+ {
+ max_length= min(args[0]->max_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(); }
};
@@ -417,13 +422,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)
{
- max_length= min(args[0]->max_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);
};