diff options
author | unknown <mskold@mysql.com> | 2005-01-21 08:43:41 +0100 |
---|---|---|
committer | unknown <mskold@mysql.com> | 2005-01-21 08:43:41 +0100 |
commit | 5c52b71d4872ae556d9f4f087f6ff9e0d0074f1e (patch) | |
tree | 98550be0e92e345e463c3f159d07fb888eadeabb /sql/item_cmpfunc.cc | |
parent | 78edb8a569e33ae8f7957240166c0a5eef9f0347 (diff) | |
parent | 205c24279aea5a4edd5130d5c533fb7553f3fad2 (diff) | |
download | mariadb-git-5c52b71d4872ae556d9f4f087f6ff9e0d0074f1e.tar.gz |
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into mysql.com:/usr/local/home/marty/MySQL/test/mysql-5.0-ndb
sql/filesort.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 62 |
1 files changed, 7 insertions, 55 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index e840d66c962..a8c580d45f1 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1119,6 +1119,9 @@ Item_func_nullif::fix_length_and_dec() max_length=args[0]->max_length; decimals=args[0]->decimals; agg_result_type(&cached_result_type, args, 2); + if (cached_result_type == STRING_RESULT && + agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV)) + return; } } @@ -1773,64 +1776,13 @@ void Item_func_in::fix_length_and_dec() agg_cmp_type(&cmp_type, args, arg_count); + if (cmp_type == STRING_RESULT && + agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV)) + return; + for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++) const_itm&= arg[0]->const_item(); - - if (cmp_type == STRING_RESULT) - { - /* - We allow consts character set conversion for - - item IN (const1, const2, const3, ...) - - if item is in a superset for all arguments, - and if it is a stong side according to coercibility rules. - - TODO: add covnersion for non-constant IN values - via creating Item_func_conv_charset(). - */ - - if (agg_arg_collations_for_comparison(cmp_collation, args, arg_count, - MY_COLL_ALLOW_SUPERSET_CONV)) - return; - if ((!my_charset_same(args[0]->collation.collation, - cmp_collation.collation) || !const_itm)) - { - if (agg_arg_collations_for_comparison(cmp_collation, args, arg_count)) - return; - } - else - { - /* - Conversion is possible: - All IN arguments are constants. - */ - Item_arena *arena, backup; - arena= thd->change_arena_if_needed(&backup); - - for (arg= args+1, arg_end= args+arg_count; arg < arg_end; arg++) - { - if (!arg[0]->null_value && - !my_charset_same(cmp_collation.collation, - arg[0]->collation.collation)) - { - Item_string *conv; - String tmp, cstr, *ostr= arg[0]->val_str(&tmp); - uint dummy_errors; - cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), - cmp_collation.collation, &dummy_errors); - conv= new Item_string(cstr.ptr(),cstr.length(), cstr.charset(), - arg[0]->collation.derivation); - conv->str_value.copy(); - arg[0]= conv; - } - } - if (arena) - thd->restore_backup_item_arena(arena, &backup); - } - } - /* Row item with NULLs inside can return NULL or FALSE => they can't be processed as static |