Commit 93cfdcdf authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

item_cmpfunc.cc:

  cmp_charset was not initialized
  valgrind fix
  LIKE now works according to coercibility rules
parent 6814c8d3
...@@ -1780,7 +1780,7 @@ longlong Item_func_like::val_int() ...@@ -1780,7 +1780,7 @@ longlong Item_func_like::val_int()
null_value=0; null_value=0;
if (canDoTurboBM) if (canDoTurboBM)
return turboBM_matches(res->ptr(), res->length()) ? 1 : 0; return turboBM_matches(res->ptr(), res->length()) ? 1 : 0;
return my_wildcmp(charset(), return my_wildcmp(cmp_charset,
res->ptr(),res->ptr()+res->length(), res->ptr(),res->ptr()+res->length(),
res2->ptr(),res2->ptr()+res2->length(), res2->ptr(),res2->ptr()+res2->length(),
escape,wild_one,wild_many) ? 0 : 1; escape,wild_one,wild_many) ? 0 : 1;
...@@ -1813,14 +1813,12 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref) ...@@ -1813,14 +1813,12 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
if (Item_bool_func2::fix_fields(thd, tlist, ref)) if (Item_bool_func2::fix_fields(thd, tlist, ref))
return 1; return 1;
/* if (set_cmp_charset(args[0]->charset(), args[0]->coercibility,
Comparision is by default done according to character set of LIKE args[1]->charset(), args[1]->coercibility))
QQ: COERCIBILITY {
*/ my_error(ER_WRONG_ARGUMENTS,MYF(0),func_name());
if (cmp_charset == &my_charset_bin) return 1;
set_charset(&my_charset_bin); }
else
set_charset(args[1]->charset());
/* /*
We could also do boyer-more for non-const items, but as we would have to We could also do boyer-more for non-const items, but as we would have to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment