summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorholyfoot/hf@mysql.com/deer.(none) <>2006-10-12 13:50:22 +0500
committerholyfoot/hf@mysql.com/deer.(none) <>2006-10-12 13:50:22 +0500
commitedc902684232fd04696f31b69a8f494f752d1b36 (patch)
tree463e189f3d056f27e63df311f204f3cc1b4b0993 /strings
parent2c7ef3ebacd45d21a3f09ff5a245d57f3d65be4a (diff)
parent5dded17489acd0faac3f32e911090f4e9bc8fb07 (diff)
downloadmariadb-git-edc902684232fd04696f31b69a8f494f752d1b36.tar.gz
Merge bk@192.168.21.1:mysql-4.1
into mysql.com:/home/hf/mysql-5.0.mrg
Diffstat (limited to 'strings')
-rw-r--r--strings/CHARSET_INFO.txt12
-rw-r--r--strings/ctype-mb.c32
-rw-r--r--strings/ctype-utf8.c2
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,