diff options
author | bar@mysql.com <> | 2005-09-21 23:10:51 +0500 |
---|---|---|
committer | bar@mysql.com <> | 2005-09-21 23:10:51 +0500 |
commit | d870612ac0ec97defd06f1cc9f5db4fd84077d1f (patch) | |
tree | 519dad549da8beab9748d94f1ae4894caf051d8f /strings/ctype-simple.c | |
parent | 15bf8f6adadd31ea09f879e0656e37809eea3ca3 (diff) | |
download | mariadb-git-d870612ac0ec97defd06f1cc9f5db4fd84077d1f.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.
Diffstat (limited to 'strings/ctype-simple.c')
-rw-r--r-- | strings/ctype-simple.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index af673b78254..efddab621f2 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -997,17 +997,12 @@ my_bool my_like_range_simple(CHARSET_INFO *cs, 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; -#ifdef USE_MB - uint charlen= my_charpos(cs, ptr, ptr+ptr_length, res_length/cs->mbmaxlen); - if (charlen < ptr_length) - ptr_length= charlen; -#endif - end= ptr + ptr_length; + uint charlen= res_length / cs->mbmaxlen; - for (; ptr != end && min_str != min_end ; ptr++) + for (; ptr != end && min_str != min_end && charlen > 0 ; ptr++, charlen--) { if (*ptr == escape && ptr+1 != end) { |