Commit e5e81f45 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

LIKE didn't work with non-default charset

parent c767f0b2
...@@ -37,3 +37,70 @@ select * from t1 where a like "%abc\d%"; ...@@ -37,3 +37,70 @@ select * from t1 where a like "%abc\d%";
a a
abcd abcd
drop table t1; drop table t1;
SET NAMES koi8r;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
INSERT INTO t1 VALUES (''),(''),(''),(''),(''),('');
INSERT INTO t1 VALUES (''),(''),(''),('');
INSERT INTO t1 VALUES (''),(''),(''),('');
INSERT INTO t1 VALUES (''),(''),(''),('');
SELECT * FROM t1 WHERE a LIKE '%%';
a
SELECT * FROM t1 WHERE a LIKE '%%';
a
SELECT * FROM t1 WHERE a LIKE '%';
a
DROP TABLE t1;
...@@ -24,3 +24,23 @@ select * from t1 where a like "%abcd%"; ...@@ -24,3 +24,23 @@ select * from t1 where a like "%abcd%";
select * from t1 where a like "%abc\d%"; select * from t1 where a like "%abc\d%";
drop table t1; drop table t1;
#
# Test like with non-default character set
#
SET NAMES koi8r;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET koi8r);
INSERT INTO t1 VALUES (''),(''),(''),(''),(''),('');
INSERT INTO t1 VALUES (''),(''),(''),('');
INSERT INTO t1 VALUES (''),(''),(''),('');
INSERT INTO t1 VALUES (''),(''),(''),('');
SELECT * FROM t1 WHERE a LIKE '%%';
SELECT * FROM t1 WHERE a LIKE '%%';
SELECT * FROM t1 WHERE a LIKE '%';
DROP TABLE t1;
...@@ -2139,7 +2139,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const ...@@ -2139,7 +2139,7 @@ bool Item_func_like::turboBM_matches(const char* text, int text_len) const
int shift = pattern_len; int shift = pattern_len;
int j = 0; int j = 0;
int u = 0; int u = 0;
CHARSET_INFO *cs=system_charset_info; // QQ Needs to be fixed CHARSET_INFO *cs= cmp.cmp_collation.collation; // QQ Needs to be fixed
const int plm1= pattern_len - 1; const int plm1= pattern_len - 1;
const int tlmpl= text_len - pattern_len; const int tlmpl= text_len - pattern_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment