diff options
author | unknown <bar@mysql.com> | 2005-07-22 14:47:13 +0500 |
---|---|---|
committer | unknown <bar@mysql.com> | 2005-07-22 14:47:13 +0500 |
commit | f0e62d624a9b1c2a6bd1dfdb67f0eefa75d5682c (patch) | |
tree | 65e83990edeb620a973b518042feb621d01efbfc | |
parent | f1029fd7a79b24a0fa904a37e74f6e3c2684dba1 (diff) | |
parent | d1e96a25d733c3d17ba564fe77efe8f8bf2a4960 (diff) | |
download | mariadb-git-f0e62d624a9b1c2a6bd1dfdb67f0eefa75d5682c.tar.gz |
Merge mysql.com:/usr/home/bar/mysql-4.1.b11754
into mysql.com:/usr/home/bar/mysql-5.0
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
strings/ctype-utf8.c:
Auto merged
-rw-r--r-- | mysql-test/r/ctype_utf8.result | 39 | ||||
-rw-r--r-- | mysql-test/t/ctype_utf8.test | 21 | ||||
-rw-r--r-- | strings/ctype-utf8.c | 18 |
3 files changed, 70 insertions, 8 deletions
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 66db34bdf83..64c693a292a 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -954,6 +954,45 @@ char_length(a) length(a) a 2 2 12 2 4 ан drop table t1; +set names utf8; +select 'a\\' like 'a\\'; +'a\\' like 'a\\' +1 +select 'aa\\' like 'a%\\'; +'aa\\' like 'a%\\' +1 +create table t1 (a char(10), key(a)) character set utf8; +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +select * from t1 where a like "abc%"; +a +abc +abcd +select * from t1 where a like concat("abc","%"); +a +abc +abcd +select * from t1 where a like "ABC%"; +a +abc +abcd +select * from t1 where a like "test%"; +a +test +select * from t1 where a like "te_t"; +a +test +select * from t1 where a like "%a%"; +a +a +abc +abcd +select * from t1 where a like "%abcd%"; +a +abcd +select * from t1 where a like "%abc\d%"; +a +abcd +drop table t1; CREATE TABLE t1 ( a varchar(255) NOT NULL default '', KEY a (a) diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index bcb8ec2ba76..b361b056332 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -810,6 +810,27 @@ alter table t1 modify a char(2) character set utf8; select char_length(a), length(a), a from t1 order by a; drop table t1; + +# +# Bugs#11754: SET NAMES utf8 followed by SELECT "A\\" LIKE "A\\" returns 0 +# +set names utf8; +select 'a\\' like 'a\\'; +select 'aa\\' like 'a%\\'; + +create table t1 (a char(10), key(a)) character set utf8; +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +select * from t1 where a like "abc%"; +select * from t1 where a like concat("abc","%"); +select * from t1 where a like "ABC%"; +select * from t1 where a like "test%"; +select * from t1 where a like "te_t"; +select * from t1 where a like "%a%"; +select * from t1 where a like "%abcd%"; +select * from t1 where a like "%abc\d%"; +drop table t1; + + # # Bug#9557 MyISAM utf8 table crash # diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index de08c080b3b..2b5f5883abf 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -1739,7 +1739,7 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, } wildstr+= scan; - if (w_wc == (my_wc_t)escape) + if (w_wc == (my_wc_t)escape && wildstr < wildend) { if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, (const uchar*)wildend)) <= 0) @@ -1811,13 +1811,17 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, (const uchar*)wildend)) <=0) return 1; + wildstr+= scan; if (w_wc == (my_wc_t)escape) { - wildstr+= scan; - if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, - (const uchar*)wildend)) <=0) - return 1; + if (wildstr < wildend) + { + if ((scan= mb_wc(cs, &w_wc, (const uchar*)wildstr, + (const uchar*)wildend)) <=0) + return 1; + wildstr+= scan; + } } while (1) @@ -1843,14 +1847,12 @@ int my_wildcmp_unicode(CHARSET_INFO *cs, if (str == str_end) return -1; + str+= scan; result= my_wildcmp_unicode(cs, str, str_end, wildstr, wildend, escape, w_one, w_many, weights); - if (result <= 0) return result; - - str+= scan; } } } |