summaryrefslogtreecommitdiff
path: root/strings/ctype-cp932.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-09-11 20:43:48 +0200
committerSergei Golubchik <sergii@pisem.net>2010-09-11 20:43:48 +0200
commita3d80d952d7b99680ca4a3a89e128ecc0d490c10 (patch)
tree0d72ee69e037cdd09618ddb53652dd1b220890dc /strings/ctype-cp932.c
parentec06ba24553d2d83b3a6a6bc4d8150910b01ee7c (diff)
parent966661c8cc75dd7d540a5fe40b4d893c40e91d26 (diff)
downloadmariadb-git-a3d80d952d7b99680ca4a3a89e128ecc0d490c10.tar.gz
merge with 5.1
Diffstat (limited to 'strings/ctype-cp932.c')
-rw-r--r--strings/ctype-cp932.c76
1 files changed, 3 insertions, 73 deletions
diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c
index 2caffe7aea2..4453516c7b3 100644
--- a/strings/ctype-cp932.c
+++ b/strings/ctype-cp932.c
@@ -306,76 +306,6 @@ static size_t my_strnxfrm_cp932(CHARSET_INFO *cs __attribute__((unused)),
}
-/*
-** Calculate min_str and max_str that ranges a LIKE string.
-** Arguments:
-** ptr Pointer to LIKE string.
-** ptr_length Length of LIKE string.
-** escape Escape character in LIKE. (Normally '\').
-** All escape characters should be removed from min_str and max_str
-** res_length Length of min_str and max_str.
-** min_str Smallest case sensitive string that ranges LIKE.
-** Should be space padded to res_length.
-** max_str Largest case sensitive string that ranges LIKE.
-** Normally padded with the biggest character sort value.
-**
-** The function should return 0 if ok and 1 if the LIKE string can't be
-** optimized !
-*/
-
-#define max_sort_char ((char) 255)
-
-static my_bool my_like_range_cp932(CHARSET_INFO *cs __attribute__((unused)),
- const char *ptr,size_t ptr_length,
- pbool escape, pbool w_one, pbool w_many,
- size_t res_length,
- char *min_str,char *max_str,
- size_t *min_length, size_t *max_length)
-{
- const char *end=ptr+ptr_length;
- char *min_org=min_str;
- char *min_end=min_str+res_length;
-
- while (ptr < end && min_str < min_end) {
- if (ismbchar_cp932(cs, ptr, end)) {
- *min_str++ = *max_str++ = *ptr++;
- if (min_str < min_end)
- *min_str++ = *max_str++ = *ptr++;
- continue;
- }
- if (*ptr == escape && ptr+1 < end) {
- ptr++; /* Skip escape */
- if (ismbchar_cp932(cs, ptr, end))
- *min_str++ = *max_str++ = *ptr++;
- if (min_str < min_end)
- *min_str++ = *max_str++ = *ptr++;
- continue;
- }
- if (*ptr == w_one) { /* '_' in SQL */
- *min_str++ = '\0'; /* This should be min char */
- *max_str++ = max_sort_char;
- ptr++;
- continue;
- }
- if (*ptr == w_many)
- { /* '%' in SQL */
- *min_length = (size_t)(min_str - min_org);
- *max_length = res_length;
- do
- {
- *min_str++= 0;
- *max_str++= max_sort_char;
- } while (min_str < min_end);
- return 0;
- }
- *min_str++ = *max_str++ = *ptr++;
- }
- *min_length = *max_length = (size_t) (min_str - min_org);
- while (min_str < min_end)
- *min_str++ = *max_str++ = ' '; /* Because if key compression */
- return 0;
-}
-
/* page 0 0x00A1-0x00DF */
static const uint16 tab_cp932_uni0[]={
0xFF61,0xFF62,0xFF63,0xFF64,0xFF65,0xFF66,0xFF67,0xFF68,
@@ -5467,7 +5397,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
my_strnncollsp_cp932,
my_strnxfrm_cp932,
my_strnxfrmlen_simple,
- my_like_range_cp932,
+ my_like_range_mb,
my_wildcmp_mb, /* wildcmp */
my_strcasecmp_8bit,
my_instr_mb,
@@ -5533,7 +5463,7 @@ struct charset_info_st my_charset_cp932_japanese_ci=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFCFC, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
@@ -5565,7 +5495,7 @@ struct charset_info_st my_charset_cp932_bin=
1, /* mbminlen */
2, /* mbmaxlen */
0, /* min_sort_char */
- 255, /* max_sort_char */
+ 0xFCFC, /* max_sort_char */
' ', /* pad char */
1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,