diff options
author | Michael Widenius <monty@askmonty.org> | 2009-12-03 14:02:37 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2009-12-03 14:02:37 +0200 |
commit | 626dd5e81a87f2eefecc49f7a140708062d7fde4 (patch) | |
tree | 100655a3b097525c21bc6c8101634b71e408ee64 /strings | |
parent | 65ca2521f18b0b3400d8b45edae30baf2dbd6401 (diff) | |
download | mariadb-git-626dd5e81a87f2eefecc49f7a140708062d7fde4.tar.gz |
Applied patch from to fix some problems with Croatian character set and LIKE queries
Author: Alexander Barkov
License: GPL
mysql-test/t/ctype_ucs.test:
Added test case for Croatina character set
Diffstat (limited to 'strings')
-rw-r--r-- | strings/ctype-ucs2.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 2607e0f6d43..7ad25fb3565 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1498,6 +1498,14 @@ void my_hash_sort_ucs2_bin(CHARSET_INFO *cs __attribute__((unused)), } } + +static inline my_wc_t +ucs2_to_wc(const uchar *ptr) +{ + return (((uint) ptr[0]) << 8) + ptr[1]; +} + + /* ** Calculate min_str and max_str that ranges a LIKE string. ** Arguments: @@ -1531,6 +1539,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0 ; ptr+=2, charlen--) { + my_wc_t wc; if (ptr[0] == '\0' && ptr[1] == escape && ptr + 1 < end) { ptr+=2; /* Skip escape */ @@ -1567,9 +1576,9 @@ fill_max_and_min: } if (have_contractions && ptr + 3 < end && - ptr[0] == '\0' && - my_uca_can_be_contraction_head(cs, (uchar) ptr[1])) + my_uca_can_be_contraction_head(cs, (wc= ucs2_to_wc((uchar*) ptr)))) { + my_wc_t wc2; /* Contraction head found */ if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many)) { @@ -1581,9 +1590,8 @@ fill_max_and_min: Check if the second letter can be contraction part, and if two letters really produce a contraction. */ - if (ptr[2] == '\0' && - my_uca_can_be_contraction_tail(cs, (uchar) ptr[3]) && - my_uca_contraction2_weight(cs,(uchar) ptr[1], (uchar) ptr[3])) + if (my_uca_can_be_contraction_tail(cs, (wc2= ucs2_to_wc((uchar*) ptr + 2))) && + my_uca_contraction2_weight(cs, wc , wc2)) { /* Contraction found */ if (charlen == 1 || min_str + 2 >= min_end) |