summaryrefslogtreecommitdiff
path: root/strings/ctype-sjis.c
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-09-21 23:10:51 +0500
committerunknown <bar@mysql.com>2005-09-21 23:10:51 +0500
commit14912660c39354c366419d65899bc95061d63e6e (patch)
tree519dad549da8beab9748d94f1ae4894caf051d8f /strings/ctype-sjis.c
parent4014d76cd1a7bbab348f2e47d852518e11526777 (diff)
downloadmariadb-git-14912660c39354c366419d65899bc95061d63e6e.tar.gz
Bug#13046: LIKE pattern matching using prefix
index doesn't return correct result item_cmpfunc.cc: Use charset of LIKE to decide whether to use 8bit or Unicode "escape" value. But use charset of "escape" to scan escape character. strings/ctype-xxx.c: We cannot reduce "end" pointer using charpos(), because of possible escape characters in the string. Limit the loop using count of written characters instead. ctype_like_escape.inc: new file mysql-test/t/ctype_xxx: mysql-test/r/ctype_xxx: Adding test case. strings/ctype-big5.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead. strings/ctype-cp932.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead strings/ctype-gbk.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead strings/ctype-mb.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead strings/ctype-simple.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead strings/ctype-sjis.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead strings/ctype-tis620.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead strings/ctype-ucs2.c: Bug#13046: LIKE pattern matching using prefix index doesn't return correct result We cannot change "end" pointer using charpos(), because of possible escape characters. Use limit by count of written characters instead mysql-test/t/ctype_big5.test: Adding test case. mysql-test/t/ctype_cp932.test: Adding test case. mysql-test/t/ctype_gbk.test: Adding test case. mysql-test/t/ctype_latin1.test: Adding test case. mysql-test/t/ctype_sjis.test: Adding test case. mysql-test/t/ctype_tis620.test: Adding test case. mysql-test/t/ctype_uca.test: Adding test case. mysql-test/t/ctype_ucs.test: Adding test case. mysql-test/t/ctype_ujis.test: Adding test case. mysql-test/t/ctype_utf8.test: Adding test case. mysql-test/r/ctype_big5.result: Adding test case. mysql-test/r/ctype_cp932.result: Adding test case. mysql-test/r/ctype_gbk.result: Adding test case. mysql-test/r/ctype_latin1.result: Adding test case. mysql-test/r/ctype_sjis.result: Adding test case. mysql-test/r/ctype_tis620.result: Adding test case. mysql-test/r/ctype_uca.result: Adding test case. mysql-test/r/ctype_ucs.result: Adding test case. mysql-test/r/ctype_ujis.result: Adding test case. mysql-test/r/ctype_utf8.result: Adding test case. sql/item_cmpfunc.cc: More fixes.
Diffstat (limited to 'strings/ctype-sjis.c')
-rw-r--r--strings/ctype-sjis.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 4342fc670df..da79f1796b8 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -322,16 +322,13 @@ static my_bool my_like_range_sjis(CHARSET_INFO *cs __attribute__((unused)),
uint res_length, char *min_str,char *max_str,
uint *min_length,uint *max_length)
{
- const char *end;
+ const char *end= ptr + ptr_length;
char *min_org=min_str;
char *min_end=min_str+res_length;
- uint charlen= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen);
+ uint charlen= res_length / cs->mbmaxlen;
- if (charlen < ptr_length)
- ptr_length= charlen;
- end= ptr + ptr_length;
-
- while (ptr < end && min_str < min_end) {
+ for ( ; ptr < end && min_str < min_end && charlen > 0 ; charlen--)
+ {
if (ismbchar_sjis(cs, ptr, end)) {
*min_str++ = *max_str++ = *ptr++;
if (min_str < min_end)