diff options
author | bar@bar.mysql.r18.ru <> | 2003-01-31 13:48:35 +0400 |
---|---|---|
committer | bar@bar.mysql.r18.ru <> | 2003-01-31 13:48:35 +0400 |
commit | 52c053ca9b3a7a911eb56588335b742c65c56aaf (patch) | |
tree | 8e0320352c1ef07c08e1cb4e613ca6f98b21604a | |
parent | 0a48aeb2c1ba7b885d322dd9641d3f31469972a4 (diff) | |
download | mariadb-git-52c053ca9b3a7a911eb56588335b742c65c56aaf.tar.gz |
New CHARSET_INFO function to compare strings regardless to trailing spaces
-rw-r--r-- | include/m_ctype.h | 5 | ||||
-rw-r--r-- | mysys/charset.c | 1 | ||||
-rw-r--r-- | strings/ctype-big5.c | 11 | ||||
-rw-r--r-- | strings/ctype-bin.c | 1 | ||||
-rw-r--r-- | strings/ctype-czech.c | 13 | ||||
-rw-r--r-- | strings/ctype-euc_kr.c | 1 | ||||
-rw-r--r-- | strings/ctype-extra.c | 24 | ||||
-rw-r--r-- | strings/ctype-gb2312.c | 1 | ||||
-rw-r--r-- | strings/ctype-gbk.c | 11 | ||||
-rw-r--r-- | strings/ctype-latin1.c | 1 | ||||
-rw-r--r-- | strings/ctype-latin1_de.c | 11 | ||||
-rw-r--r-- | strings/ctype-simple.c | 20 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 11 | ||||
-rw-r--r-- | strings/ctype-tis620.c | 12 | ||||
-rw-r--r-- | strings/ctype-ujis.c | 3 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 13 | ||||
-rw-r--r-- | strings/ctype-win1250ch.c | 12 |
17 files changed, 150 insertions, 1 deletions
diff --git a/include/m_ctype.h b/include/m_ctype.h index 5cc934eb7cf..66f1a02b7ab 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -92,6 +92,8 @@ typedef struct charset_info_st uint strxfrm_multiply; int (*strnncoll)(struct charset_info_st *, const uchar *, uint, const uchar *, uint); + int (*strnncollsp)(struct charset_info_st *, + const uchar *, uint, const uchar *, uint); int (*strnxfrm)(struct charset_info_st *, uchar *, uint, const uchar *, uint); my_bool (*like_range)(struct charset_info_st *, @@ -189,6 +191,9 @@ extern int my_strnxfrm_simple(CHARSET_INFO *, uchar *, uint, const uchar *, extern int my_strnncoll_simple(CHARSET_INFO *, const uchar *, uint, const uchar *, uint); +extern int my_strnncollsp_simple(CHARSET_INFO *, const uchar *, uint, + const uchar *, uint); + extern uint my_hash_caseup_simple(CHARSET_INFO *cs, const byte *key, uint len); diff --git a/mysys/charset.c b/mysys/charset.c index 68377aec355..5f95889a231 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -59,6 +59,7 @@ static void simple_cs_init_functions(CHARSET_INFO *cs) cs->strnxfrm = my_strnxfrm_simple; cs->strnncoll = my_strnncoll_simple; + cs->strnncollsp = my_strnncollsp_simple; cs->like_range = my_like_range_simple; cs->wildcmp = my_wildcmp_8bit; cs->mb_wc = my_mb_wc_8bit; diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index e1cc0b6e8ab..89a25666bd8 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -242,6 +242,16 @@ static int my_strnncoll_big5(CHARSET_INFO *cs __attribute__((unused)), return (int) (len1-len2); } +static +int my_strnncollsp_big5(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_big5(cs,s,slen,t,tlen); +} + static int my_strnxfrm_big5(CHARSET_INFO *cs __attribute__((unused)), uchar * dest, uint len, const uchar * src, uint srclen) @@ -6236,6 +6246,7 @@ CHARSET_INFO my_charset_big5 = NULL, /* tab_from_uni */ 1, /* strxfrm_multiply */ my_strnncoll_big5, + my_strnncollsp_big5, my_strnxfrm_big5, my_like_range_big5, my_wildcmp_mb, diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 5f9dc9929ab..1b9c67c10a9 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -284,6 +284,7 @@ CHARSET_INFO my_charset_bin = NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_binary, /* strnncoll */ + my_strnncoll_binary, my_strnxfrm_bin, /* strxnfrm */ my_like_range_simple, /* like_range */ my_wildcmp_bin, /* wildcmp */ diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index 3e351732212..9d6b8fe2131 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -593,6 +593,18 @@ static MY_UNI_IDX idx_uni_8859_2[]={ {0,0,NULL} }; + +static +int my_strnncollsp_czech(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_czech(cs,s,slen,t,tlen); +} + + CHARSET_INFO my_charset_czech = { 2, /* number */ @@ -608,6 +620,7 @@ CHARSET_INFO my_charset_czech = idx_uni_8859_2, /* tab_from_uni */ 4, /* strxfrm_multiply */ my_strnncoll_czech, + my_strnncollsp_czech, my_strnxfrm_czech, my_like_range_czech, my_wildcmp_8bit, diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index 7a2fe48f4ab..938f215e2de 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8654,6 +8654,7 @@ CHARSET_INFO my_charset_euc_kr = NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple, my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_mb, /* wildcmp */ diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c index b7a7bea7bb1..6100c74860b 100644 --- a/strings/ctype-extra.c +++ b/strings/ctype-extra.c @@ -2820,6 +2820,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_8859_1, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -2868,6 +2869,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_cp1251, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -2915,6 +2917,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_cp1257, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -2962,6 +2965,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_8859_2, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3010,6 +3014,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_8859_1, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3057,6 +3062,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3104,6 +3110,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3151,6 +3158,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3199,6 +3207,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_8859_1, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3246,6 +3255,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3293,6 +3303,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3340,6 +3351,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3387,6 +3399,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_8859_2, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3434,6 +3447,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_koi8_r, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3481,6 +3495,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_koi8_u, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3529,6 +3544,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_8859_2, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3576,6 +3592,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_8859_9, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3624,6 +3641,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3672,6 +3690,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_us_ascii, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3719,6 +3738,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_cp1250, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3766,6 +3786,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_cp1251, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3813,6 +3834,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_armscii_8, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3860,6 +3882,7 @@ CHARSET_INFO compiled_charsets[] = { idx_uni_cp1251, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple,/* strnncollsp */ my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_8bit, /* wildcmp */ @@ -3906,6 +3929,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, /* tab_from_uni */ 0, NULL, /* strnncoll */ + NULL, /* strnncollsp */ NULL, /* strnxfrm */ NULL, /* like_range */ NULL, /* wildcmp */ diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index c0baca808cb..ff2dcd381c1 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5704,6 +5704,7 @@ CHARSET_INFO my_charset_gb2312 = NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple, my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_mb, /* wildcmp */ diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 5db91d09cc8..a7a29a4af7a 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -2608,6 +2608,16 @@ int my_strnncoll_gbk(CHARSET_INFO *cs __attribute__((unused)), return (int) (len1-len2); } +static +int my_strnncollsp_gbk(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_gbk(cs,s,slen,t,tlen); +} + int my_strnxfrm_gbk(CHARSET_INFO *cs __attribute__((unused)), uchar * dest, uint len, @@ -9891,6 +9901,7 @@ CHARSET_INFO my_charset_gbk = NULL, /* tab_from_uni */ 1, /* strxfrm_multiply */ my_strnncoll_gbk, + my_strnncollsp_gbk, my_strnxfrm_gbk, my_like_range_gbk, my_wildcmp_mb, /* wildcmp */ diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index ac1e6dcdc18..588eff0cab1 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -190,6 +190,7 @@ CHARSET_INFO my_charset_latin1 = NULL, /* tab_from_uni */ 2, /* strxfrm_multiply */ my_strnncoll_simple, + my_strnncollsp_simple, my_strnxfrm_simple, my_like_range_simple, my_wildcmp_8bit, /* wildcmp */ diff --git a/strings/ctype-latin1_de.c b/strings/ctype-latin1_de.c index 2e06d9d1a8f..0a6de1ca86b 100644 --- a/strings/ctype-latin1_de.c +++ b/strings/ctype-latin1_de.c @@ -295,6 +295,16 @@ static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)), return s1 < e1 ? 1 : s2 < e2 ? -1 : 0; } +static +int my_strnncollsp_latin1_de(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_latin1_de(cs,s,slen,t,tlen); +} + static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), uchar * dest, uint len, @@ -351,6 +361,7 @@ CHARSET_INFO my_charset_latin1_de = idx_uni_8859_1, /* tab_from_uni */ 2, /* strxfrm_multiply */ my_strnncoll_latin1_de, + my_strnncollsp_latin1_de, my_strnxfrm_latin1_de, my_like_range_simple, my_wildcmp_8bit, /* wildcmp */ diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 52496f55cf9..c4c89d02d58 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -50,6 +50,26 @@ int my_strnncoll_simple(CHARSET_INFO * cs, const uchar *s, uint slen, return (int) (slen-tlen); } + +int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + uchar *map= cs->sort_order; + int len; + + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + + len = ( slen > tlen ) ? tlen : slen; + + while (len--) + { + if (map[*s++] != map[*t++]) + return ((int) map[s[-1]] - (int) map[t[-1]]); + } + return (int) (slen-tlen); +} + void my_caseup_str_8bit(CHARSET_INFO * cs,char *str) { register uchar *map=cs->to_upper; diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index b666bdf20d2..4d9bb4be30c 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -227,6 +227,16 @@ static int my_strnncoll_sjis(CHARSET_INFO *cs __attribute__((unused)), return len1 - len2; } +static +int my_strnncollsp_sjis(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_sjis(cs,s,slen,t,tlen); +} + static int my_strnxfrm_sjis(CHARSET_INFO *cs __attribute__((unused)), uchar *dest, uint len, const uchar *src, uint srclen) @@ -4478,6 +4488,7 @@ CHARSET_INFO my_charset_sjis = NULL, /* tab_from_uni */ 1, /* strxfrm_multiply */ my_strnncoll_sjis, + my_strnncollsp_sjis, my_strnxfrm_sjis, my_like_range_sjis, my_wildcmp_mb, /* wildcmp */ diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 5461173b766..d43361a1723 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -551,6 +551,17 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), return(i); } +static +int my_strnncollsp_tis620(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_tis620(cs,s,slen,t,tlen); +} + + /* strnxfrm replacment, convert Thai string to sortable string Arg: Destination buffer, source string, dest length and source length Ret: Conveted string size @@ -700,6 +711,7 @@ CHARSET_INFO my_charset_tis620 = NULL, /* tab_from_uni */ 4, /* strxfrm_multiply */ my_strnncoll_tis620, + my_strnncollsp_tis620, my_strnxfrm_tis620, my_like_range_tis620, my_wildcmp_8bit, /* wildcmp */ diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index 268a9e2296e..19f89f1b755 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8444,7 +8444,8 @@ CHARSET_INFO my_charset_ujis = NULL, /* tab_to_uni */ NULL, /* tab_from_uni */ 0, /* strxfrm_multiply */ - NULL, /* strnncoll */ + my_strnncoll_simple,/* strnncoll */ + my_strnncollsp_simple, my_strnxfrm_simple, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_mb, /* wildcmp */ diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index c4c12efe8b2..fc8a4c0fb64 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1855,6 +1855,17 @@ static int my_strnncoll_utf8(CHARSET_INFO *cs, return ( (se-s) - (te-t) ); } +static +int my_strnncollsp_utf8(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_utf8(cs,s,slen,t,tlen); +} + + static int my_strncasecmp_utf8(CHARSET_INFO *cs, const char *s, const char *t, uint len) { @@ -1979,6 +1990,7 @@ CHARSET_INFO my_charset_utf8 = NULL, /* tab_from_uni */ 1, /* strxfrm_multiply */ my_strnncoll_utf8, /* strnncoll */ + my_strnncollsp_utf8, my_strnxfrm_utf8, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_mb, /* wildcmp */ @@ -3068,6 +3080,7 @@ CHARSET_INFO my_charset_ucs2 = NULL, /* tab_from_uni */ 1, /* strxfrm_multiply */ my_strnncoll_ucs2, /* strnncoll */ + my_strnncoll_ucs2, my_strnxfrm_ucs2, /* strnxfrm */ my_like_range_simple,/* like_range */ my_wildcmp_mb, /* wildcmp */ diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index f5074a4ec0e..3ed48f13913 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -503,6 +503,17 @@ static int my_strnncoll_win1250ch(CHARSET_INFO *cs __attribute__((unused)), return 0; } +static +int my_strnncollsp_win1250ch(CHARSET_INFO * cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) +{ + for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); + for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); + return my_strnncoll_win1250ch(cs,s,slen,t,tlen); +} + + static int my_strnxfrm_win1250ch(CHARSET_INFO * cs __attribute__((unused)), uchar * dest, uint len, const uchar * src, uint srclen) { @@ -644,6 +655,7 @@ CHARSET_INFO my_charset_win1250ch = idx_uni_cp1250, /* tab_from_uni */ 2, /* strxfrm_multiply */ my_strnncoll_win1250ch, + my_strnncollsp_win1250ch, my_strnxfrm_win1250ch, my_like_range_win1250ch, my_wildcmp_8bit, /* wildcmp */ |