diff options
author | bar@bar.mysql.r18.ru <> | 2003-03-21 18:31:41 +0400 |
---|---|---|
committer | bar@bar.mysql.r18.ru <> | 2003-03-21 18:31:41 +0400 |
commit | b3e89e3b21bcfc68423595c7c7f8962867c5c44d (patch) | |
tree | e39c3001821e39dbb28a41092f22d9489a8acf58 /sql/item_cmpfunc.cc | |
parent | c87303d4a2fa49d5cdf4d31a598063725fc213dd (diff) | |
download | mariadb-git-b3e89e3b21bcfc68423595c7c7f8962867c5c44d.tar.gz |
IF() and LEAST() now honors coercibility
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index ff6f4022877..e63f0a836de 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -723,8 +723,12 @@ Item_func_if::fix_length_and_dec() else if (arg1_type == STRING_RESULT || arg2_type == STRING_RESULT) { cached_result_type = STRING_RESULT; - set_charset((args[1]->binary() || args[2]->binary()) ? - &my_charset_bin : args[1]->charset()); + if (set_charset(args[1]->charset(), args[1]->coercibility, + args[2]->charset(), args[2]->coercibility)) + { + my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name()); + return; + } } else { @@ -760,6 +764,7 @@ Item_func_if::val_str(String *str) { Item *arg= args[0]->val_int() ? args[1] : args[2]; String *res=arg->val_str(str); + res->set_charset(charset()); null_value=arg->null_value; return res; } |