diff options
author | unknown <bar@gw.udmsearch.izhnet.ru> | 2002-04-17 17:27:13 +0500 |
---|---|---|
committer | unknown <bar@gw.udmsearch.izhnet.ru> | 2002-04-17 17:27:13 +0500 |
commit | 48297dbfcf6c3829b21662774cdc08e65dede423 (patch) | |
tree | 92e6fc45572614370bd232fe2f4004d912ac6fc8 /strings | |
parent | 804af496a1e5504fc0f5883b5dfb7502dcc0dbb4 (diff) | |
download | mariadb-git-48297dbfcf6c3829b21662774cdc08e65dede423.tar.gz |
Fix for problem that GROUP BY and DISTINCT didn't work for UTF8
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-utf8.c | 20 | ||||
-rw-r--r-- | strings/ctype.c | 35 |
2 files changed, 55 insertions, 0 deletions
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 62dcd9f6b87..a4485e1ef50 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1754,6 +1754,26 @@ uint my_hash_caseup_utf8(CHARSET_INFO *cs, const byte *s, uint slen) return nr; } + +void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, uint slen, ulong *n1, ulong *n2) +{ + my_wc_t wc; + int res; + const uchar *e=s+slen; + + while ((s < e) && (res=my_utf8_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 ) + { + int plane = (wc>>8) & 0xFF; + wc = uni_plane[plane] ? uni_plane[plane][wc & 0xFF].sort : wc; + n1[0]^= (((n1[0] & 63)+n2[0])*(wc & 0xFF))+ (n1[0] << 8); + n2[0]+=3; + n1[0]^= (((n1[0] & 63)+n2[0])*(wc >> 8))+ (n1[0] << 8); + n2[0]+=3; + s+=res; + } +} + + void my_caseup_str_utf8(CHARSET_INFO * cs, char * s) { my_caseup_utf8(cs, s, strlen(s)); diff --git a/strings/ctype.c b/strings/ctype.c index c4fb6f1388d..0c20db35da2 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -2830,6 +2830,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -2861,6 +2862,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_mb, my_strncasecmp_mb, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -2892,6 +2894,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -2923,6 +2926,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -2954,6 +2958,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -2985,6 +2990,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3016,6 +3022,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3047,6 +3054,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3078,6 +3086,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3109,6 +3118,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3140,6 +3150,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_mb, my_strncasecmp_mb, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3171,6 +3182,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_mb, my_strncasecmp_mb, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3202,6 +3214,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_mb, my_strncasecmp_mb, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3233,6 +3246,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3264,6 +3278,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3295,6 +3310,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3326,6 +3342,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3357,6 +3374,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3388,6 +3406,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3419,6 +3438,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3450,6 +3470,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3481,6 +3502,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3512,6 +3534,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3543,6 +3566,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3574,6 +3598,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3605,6 +3630,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3636,6 +3662,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_mb, my_strncasecmp_mb, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3667,6 +3694,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_utf8, my_strncasecmp_utf8, my_hash_caseup_utf8,/* hash_caseup */ + my_hash_sort_utf8, /* hash_sort */ 0 }, #endif @@ -3698,6 +3726,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3729,6 +3758,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3760,6 +3790,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3791,6 +3822,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3822,6 +3854,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3853,6 +3886,7 @@ CHARSET_INFO compiled_charsets[] = { my_strcasecmp_8bit, my_strncasecmp_8bit, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 }, #endif @@ -3885,6 +3919,7 @@ CHARSET_INFO compiled_charsets[] = { NULL, NULL, NULL, /* hash_caseup */ + NULL, /* hash_sort */ 0 } }; |