diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-09-24 17:18:45 +0400 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-09-24 17:18:45 +0400 |
commit | 7a30a12228221ae028c92105d24bef3e298cd9f2 (patch) | |
tree | 3d28a7b415cd83790f9c4b86ef9bdeac8ec26914 /sql/item_cmpfunc.cc | |
parent | 5c09a44d88de151bca34b2df9785e8e06b00f60c (diff) | |
parent | f4444c0016c68feb3f300c4b30b886cd407f5824 (diff) | |
download | mariadb-git-7a30a12228221ae028c92105d24bef3e298cd9f2.tar.gz |
Merge 5.5 -> 5.5-merge.
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index efbd99c4106..b7aad733e67 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2640,27 +2640,30 @@ Item_func_if::fix_length_and_dec() cached_result_type= arg2_type; collation.set(args[2]->collation.collation); cached_field_type= args[2]->field_type(); + max_length= args[2]->max_length; + return; } - else if (null2) + + if (null2) { cached_result_type= arg1_type; collation.set(args[1]->collation.collation); cached_field_type= args[1]->field_type(); + max_length= args[1]->max_length; + return; + } + + agg_result_type(&cached_result_type, args + 1, 2); + if (cached_result_type == STRING_RESULT) + { + if (agg_arg_charsets_for_string_result(collation, args + 1, 2)) + return; } else { - agg_result_type(&cached_result_type, args+1, 2); - if (cached_result_type == STRING_RESULT) - { - if (agg_arg_charsets_for_string_result(collation, args + 1, 2)) - return; - } - else - { - collation.set_numeric(); // Number - } - cached_field_type= agg_field_type(args + 1, 2); + collation.set_numeric(); // Number } + cached_field_type= agg_field_type(args + 1, 2); uint32 char_length; if ((cached_result_type == DECIMAL_RESULT ) |