Bug#20471 LIKE search fails with indexed utf8 char column

The main problem was already fixed by Igor under terms of 16674.
Adding some additional minor fixes and tests.


include/m_ctype.h:
  Adding reference to CHARSET_INFO.txt
mysql-test/r/ctype_utf8.result:
  Adding test case
mysql-test/t/ctype_utf8.test:
  Adding test case
strings/CHARSET_INFO.txt:
  Adding comment about max_sort_char
strings/ctype-mb.c:
  Restiring that non-Unicode character sets use 0xFF as pad character
  for max_str. Only Unicode character sets use wc_mb.
strings/ctype-utf8.c:
  Fixed that max_sort_char for UTF8 from U+00FF to U+FFFF.
This commit is contained in:
unknown 2006-07-20 15:52:48 +05:00
commit d2f7fe3558
6 changed files with 177 additions and 7 deletions

View file

@ -449,15 +449,28 @@ static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
/*
Write max key: create a buffer with multibyte
Write max key:
- for non-Unicode character sets:
just set to 255.
- for Unicode character set (utf-8):
create a buffer with multibyte
representation of the max_sort_char character,
and copy it into max_str in a loop.
*/
static void pad_max_char(CHARSET_INFO *cs, char *str, char *end)
{
char buf[10];
char buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
(uchar*) buf + sizeof(buf));
char buflen;
if (!(cs->state & MY_CS_UNICODE))
{
bfill(str, end - str, 255);
return;
}
buflen= cs->cset->wc_mb(cs, cs->max_sort_char, (uchar*) buf,
(uchar*) buf + sizeof(buf));
DBUG_ASSERT(buflen > 0);
do
{
@ -894,7 +907,7 @@ MY_COLLATION_HANDLER my_collation_mb_bin_handler =
my_strnncoll_mb_bin,
my_strnncollsp_mb_bin,
my_strnxfrm_mb_bin,
my_like_range_simple,
my_like_range_mb,
my_wildcmp_mb_bin,
my_strcasecmp_mb_bin,
my_instr_mb,