diff options
author | unknown <gshchepa/uchum@gleb.loc> | 2007-10-11 23:09:08 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@gleb.loc> | 2007-10-11 23:09:08 +0500 |
commit | f0fcc8c26704a4627963a6b3044eea40fcee143b (patch) | |
tree | a37b48b9496527f7f425a19edc1846239d318dea /sql/item_cmpfunc.cc | |
parent | 048cb42dbfadc57761ec8575b344046db91808cd (diff) | |
parent | c866f8015fcfd56c42f52865c0e89a50c055f6f8 (diff) | |
download | mariadb-git-f0fcc8c26704a4627963a6b3044eea40fcee143b.tar.gz |
Merge gleb.loc:/home/uchum/work/bk/PA/5.0-opt-31471
into gleb.loc:/home/uchum/work/bk/5.1-opt
mysql-test/r/create.result:
Auto merged
mysql-test/r/null.result:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 690661bc513..1710799d6e7 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2075,10 +2075,20 @@ Item_func_ifnull::fix_length_and_dec() agg_result_type(&hybrid_type, args, 2); maybe_null=args[1]->maybe_null; decimals= max(args[0]->decimals, args[1]->decimals); - max_length= (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT) ? - (max(args[0]->max_length - args[0]->decimals, - args[1]->max_length - args[1]->decimals) + decimals) : - max(args[0]->max_length, args[1]->max_length); + unsigned_flag= args[0]->unsigned_flag && args[1]->unsigned_flag; + + if (hybrid_type == DECIMAL_RESULT || hybrid_type == INT_RESULT) + { + int len0= args[0]->max_length - args[0]->decimals + - (args[0]->unsigned_flag ? 0 : 1); + + int len1= args[1]->max_length - args[1]->decimals + - (args[1]->unsigned_flag ? 0 : 1); + + max_length= max(len0, len1) + decimals + (unsigned_flag ? 0 : 1); + } + else + max_length= max(args[0]->max_length, args[1]->max_length); switch (hybrid_type) { case STRING_RESULT: |