diff options
author | unknown <holyfoot/hf@mysql.com/deer.(none)> | 2006-10-12 13:50:22 +0500 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/deer.(none)> | 2006-10-12 13:50:22 +0500 |
commit | bac62fa32e2bb89613948205950f140b622ebd15 (patch) | |
tree | 463e189f3d056f27e63df311f204f3cc1b4b0993 /strings | |
parent | 4fc506529cf56789307241dd0c0b348f48ef5a71 (diff) | |
parent | 1ba54cad969fe85a4d1d21140f14ede105b40555 (diff) | |
download | mariadb-git-bac62fa32e2bb89613948205950f140b622ebd15.tar.gz |
Merge bk@192.168.21.1:mysql-4.1
into mysql.com:/home/hf/mysql-5.0.mrg
include/m_ctype.h:
Auto merged
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/r/type_enum.result:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/table.cc:
Auto merged
sql/unireg.cc:
Auto merged
strings/ctype-mb.c:
SCCS merged
strings/ctype-utf8.c:
SCCS merged
Diffstat (limited to 'strings')
-rw-r--r-- | strings/CHARSET_INFO.txt | 12 | ||||
-rw-r--r-- | strings/ctype-mb.c | 32 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 2 |
3 files changed, 37 insertions, 9 deletions
diff --git a/strings/CHARSET_INFO.txt b/strings/CHARSET_INFO.txt index f7a10f95880..3fd262c6f12 100644 --- a/strings/CHARSET_INFO.txt +++ b/strings/CHARSET_INFO.txt @@ -33,7 +33,7 @@ typedef struct charset_info_st uint strxfrm_multiply; uint mbminlen; uint mbmaxlen; - char max_sort_char; /* For LIKE optimization */ + uint16 max_sort_char; /* For LIKE optimization */ MY_CHARSET_HANDLER *cset; MY_COLLATION_HANDLER *coll; @@ -134,7 +134,15 @@ Misc fields mbmaxlen - maximum multibyte sequence length. 1 for 8bit charsets. Can be also 2 or 3. - + max_sort_char - for LIKE range + in case of 8bit character sets - native code + of maximum character (max_str pad byte); + in case of UTF8 and UCS2 - Unicode code of the maximum + possible character (usually U+FFFF). This code is + converted to multibyte representation (usually 0xEFBFBF) + and then used as a pad sequence for max_str. + in case of other multibyte character sets - + max_str pad byte (usually 0xFF). MY_CHARSET_HANDLER ================== diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 0f95a688d85..394111be3bc 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -474,15 +474,35 @@ static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), /* - Write max key: create a buffer with multibyte - representation of the max_sort_char character, - and copy it into max_str in a loop. + Fill the given buffer with 'maximum character' for given charset + SYNOPSIS + pad_max_char() + cs Character set + str Start of buffer to fill + end End of buffer to fill + + DESCRIPTION + 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 { @@ -927,7 +947,7 @@ MY_COLLATION_HANDLER my_collation_mb_bin_handler = my_strnncollsp_mb_bin, my_strnxfrm_mb_bin, my_strnxfrmlen_simple, - my_like_range_simple, + my_like_range_mb, my_wildcmp_mb_bin, my_strcasecmp_mb_bin, my_instr_mb, diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 3a5c01a2861..ae2c04fb068 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2612,7 +2612,7 @@ CHARSET_INFO my_charset_utf8_bin= 1, /* mbminlen */ 3, /* mbmaxlen */ 0, /* min_sort_char */ - 255, /* max_sort_char */ + 0xFFFF, /* max_sort_char */ ' ', /* pad char */ 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, |