summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@deer.(none)>2006-10-12 15:42:05 +0500
committerunknown <holyfoot/hf@deer.(none)>2006-10-12 15:42:05 +0500
commit89d5a1a541262b6902a636d4911eb9b48a2e476b (patch)
tree01f4bc3b8707f03ab053973132c8b7ccbcbe62a9 /strings
parent16f2de1df2e585182ed558b01dd0f3ed0d1ae549 (diff)
parentbac62fa32e2bb89613948205950f140b622ebd15 (diff)
downloadmariadb-git-89d5a1a541262b6902a636d4911eb9b48a2e476b.tar.gz
Merge mysql.com:/home/hf/mysql-5.0.mrg
into mysql.com:/home/hf/mysql-5.1.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/CHARSET_INFO.txt: Auto merged strings/ctype-mb.c: Auto merged strings/ctype-utf8.c: Auto merged
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 40f171440a4..1336d5ae3bb 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 898b7a4a57d..c945164ac9c 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
{
@@ -943,7 +963,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 e221297eb55..6c3ceaf868b 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2615,7 +2615,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,