From 982f13302b60c4808c060f7dd711837aa08e328a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Sep 2003 18:07:14 +0400 Subject: Fixed openssl_1 test after error message was updated mysql-test/r/openssl_1.result: Fixed test after error message was updated --- mysql-test/r/openssl_1.result | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 0b80642fc70..4cf6bee6123 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -10,22 +10,22 @@ select * from t1; f1 5 delete from t1; -ERROR 42000: Access denied for user: 'ssl_user1@localhost' to database 'test' +ERROR 42000: Access denied for user: 'ssl_user1'@'localhost' to database 'test' select * from t1; f1 5 delete from t1; -ERROR 42000: Access denied for user: 'ssl_user2@localhost' to database 'test' +ERROR 42000: Access denied for user: 'ssl_user2'@'localhost' to database 'test' select * from t1; f1 5 delete from t1; -ERROR 42000: Access denied for user: 'ssl_user3@localhost' to database 'test' +ERROR 42000: Access denied for user: 'ssl_user3'@'localhost' to database 'test' select * from t1; f1 5 delete from t1; -ERROR 42000: Access denied for user: 'ssl_user4@localhost' to database 'test' +ERROR 42000: Access denied for user: 'ssl_user4'@'localhost' to database 'test' delete from mysql.user where user='ssl_user%'; delete from mysql.db where user='ssl_user%'; flush privileges; -- cgit v1.2.1 From 04d1b04eddc9f9668b25ad9410494d09b79ad35f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 14 Sep 2003 22:12:55 +0300 Subject: fixed proccesing global LIMIT in last SELECT of UNION mysql-test/r/subselect.result: correct results mysql-test/r/union.result: correct results mysql-test/t/subselect.test: to be sure that results are correct sql/sql_parse.cc: comment + TODO --- mysql-test/r/subselect.result | 5 +++-- mysql-test/r/union.result | 4 ++-- mysql-test/t/subselect.test | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 6cac5a9bc6c..703360dc7b5 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1046,8 +1046,9 @@ t1 CREATE TABLE `t1` ( ) TYPE=MyISAM CHARSET=latin1 drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; -Warnings: -Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 1 +select * from t1; +a +2 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 2e962190762..952ed566132 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -409,7 +409,7 @@ found_rows() SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2; a 3 -5 +4 select found_rows(); found_rows() 6 @@ -423,7 +423,7 @@ found_rows() 5 SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1; a -3 +5 (SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4; a 5 diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index ef46ba7d12c..c6a574bae62 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -606,6 +606,7 @@ CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a; SHOW CREATE TABLE t1; drop table t1; CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a; +select * from t1; SHOW CREATE TABLE t1; drop table t1; -- cgit v1.2.1 From 2e95bcc4775f509898426786e3ac844a2f9ec407 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Sep 2003 17:14:23 +0500 Subject: Bug fix: SET character_set_connection=newcharset; SELECT hex('text'); The above sequence failed in some cases. --- mysql-test/r/ctype_recoding.result | 8 ++++++++ mysql-test/t/ctype_recoding.test | 5 +++++ 2 files changed, 13 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index 564b5f8ea8f..5a53c1db2e1 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -70,3 +70,11 @@ SHOW TABLES IN Tables_in_òåñò SET CHARACTER SET koi8r; DROP DATABASE ÔÅÓÔ; +SET NAMES koi8r; +SELECT hex('ÔÅÓÔ'); +hex('ÔÅÓÔ') +D4C5D3D4 +SET character_set_connection=cp1251; +SELECT hex('ÔÅÓÔ'); +hex('ÔÅÓÔ') +F2E5F1F2 diff --git a/mysql-test/t/ctype_recoding.test b/mysql-test/t/ctype_recoding.test index bbb0d963a9d..325a8f075ed 100644 --- a/mysql-test/t/ctype_recoding.test +++ b/mysql-test/t/ctype_recoding.test @@ -45,3 +45,8 @@ SHOW TABLES; SHOW TABLES IN òåñò; SET CHARACTER SET koi8r; DROP DATABASE ÔÅÓÔ; + +SET NAMES koi8r; +SELECT hex('ÔÅÓÔ'); +SET character_set_connection=cp1251; +SELECT hex('ÔÅÓÔ'); -- cgit v1.2.1 From 334b634c9f56280e1d57679d74d6a498e0254d7b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2003 12:25:03 +0500 Subject: Fix for the bug #1333: COMPRESS(NULL) segfaults. mysql-test/r/func_compress.result: Test for the bug #1333: COMPRESS(NULL) segfaults. mysql-test/t/func_compress.test: Test for the bug #1333: COMPRESS(NULL) segfaults. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- mysql-test/r/func_compress.result | 6 ++++++ mysql-test/t/func_compress.test | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result index c4d2eacf363..57eef44b3bb 100644 --- a/mysql-test/r/func_compress.result +++ b/mysql-test/r/func_compress.result @@ -40,3 +40,9 @@ uncompress(compress("")) select uncompressed_length(""); uncompressed_length("") 0 +select compress(NULL); +compress(NULL) +NULL +select uncompress(NULL); +uncompress(NULL) +NULL diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test index 826721a4053..7462c020357 100644 --- a/mysql-test/t/func_compress.test +++ b/mysql-test/t/func_compress.test @@ -23,3 +23,9 @@ select uncompress(""); select uncompress(compress("")); select uncompressed_length(""); +# +# NULL (Bug #1333) +# + +select compress(NULL); +select uncompress(NULL); -- cgit v1.2.1 From 748a351376c35ea5a4f81881dd77bb78d6ce3fcd Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2003 14:02:49 +0500 Subject: Test for mysqldump --- mysql-test/r/mysqldump.result | 20 ++++++++++++++++++++ mysql-test/t/mysqldump.test | 10 ++++++++++ 2 files changed, 30 insertions(+) create mode 100644 mysql-test/r/mysqldump.result create mode 100644 mysql-test/t/mysqldump.test (limited to 'mysql-test') diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result new file mode 100644 index 00000000000..cf1ef55ca69 --- /dev/null +++ b/mysql-test/r/mysqldump.result @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (1), (2); + + + +DROP TABLE IF EXISTS t1; +LOCK TABLES t1 WRITE; + + + 1 + + + 2 + +
+UNLOCK TABLES; +
+
+DROP TABLE t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test new file mode 100644 index 00000000000..c98fd4050f2 --- /dev/null +++ b/mysql-test/t/mysqldump.test @@ -0,0 +1,10 @@ +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# XML output + +CREATE TABLE t1(a int); +INSERT INTO t1 VALUES (1), (2); +--exec $MYSQL_DUMP -X test t1 +DROP TABLE t1; -- cgit v1.2.1 From 44bffa0b0564a0d28558202d6cebbbea5eee1729 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2003 15:18:19 +0500 Subject: Fixed that multibyte charsets didn't honor multibyte sequence boundaries in functions LIKE and LOCATE in the case of "binary" collation. Comparison was done like if the strings were just a binary strings without character set assumption. --- mysql-test/r/ctype_ujis.result | 58 ++++++++++++++++++++++++++++++++++++++++++ mysql-test/r/have_ujis.require | 2 +- mysql-test/t/ctype_ujis.test | 26 +++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result index ffb305a81cf..1730b17eaed 100644 --- a/mysql-test/r/ctype_ujis.result +++ b/mysql-test/r/ctype_ujis.result @@ -1,4 +1,5 @@ drop table if exists t1; +set names ujis; create table t1 (c text character set ujis); insert into t1 values (0xa4a2),(0xa4a3); select hex(left(c,1)) from t1 group by c; @@ -6,3 +7,60 @@ hex(left(c,1)) A4A2 A4A3 drop table t1; +select locate(0xa2a1,0xa1a2a1a3); +locate(0xa2a1,0xa1a2a1a3) +2 +select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3); +locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3) +0 +select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin); +locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin) +0 +select locate('he','hello'); +locate('he','hello') +1 +select locate('he','hello',2); +locate('he','hello',2) +0 +select locate('lo','hello',2); +locate('lo','hello',2) +4 +select locate('HE','hello'); +locate('HE','hello') +1 +select locate('HE','hello',2); +locate('HE','hello',2) +0 +select locate('LO','hello',2); +locate('LO','hello',2) +4 +select locate('HE','hello' collate ujis_bin); +locate('HE','hello' collate ujis_bin) +0 +select locate('HE','hello' collate ujis_bin,2); +locate('HE','hello' collate ujis_bin,2) +0 +select locate('LO','hello' collate ujis_bin,2); +locate('LO','hello' collate ujis_bin,2) +0 +select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3); +locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3) +2 +select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%'); +0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%') +1 +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%'); +_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') +0 +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin; +_ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin +0 +select 'a' like 'a'; +'a' like 'a' +1 +select 'A' like 'a'; +'A' like 'a' +1 +select 'A' like 'a' collate ujis_bin; +'A' like 'a' collate ujis_bin +0 diff --git a/mysql-test/r/have_ujis.require b/mysql-test/r/have_ujis.require index b4de2234ec7..43a309ad74e 100644 --- a/mysql-test/r/have_ujis.require +++ b/mysql-test/r/have_ujis.require @@ -1,2 +1,2 @@ Collation Charset Id Default Compiled Sortlen -ujis_japanese_ci ujis 12 Yes Yes 0 +ujis_japanese_ci ujis 12 Yes Yes 1 diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index e41caf55948..bcf6507b4c7 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -7,6 +7,8 @@ drop table if exists t1; --enable_warnings +set names ujis; + # # Test problem with LEFT() # @@ -15,3 +17,27 @@ create table t1 (c text character set ujis); insert into t1 values (0xa4a2),(0xa4a3); select hex(left(c,1)) from t1 group by c; drop table t1; + +# +# +# +select locate(0xa2a1,0xa1a2a1a3); +select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3); +select locate(_ujis 0xa2a1,_ujis 0xa1a2a1a3 collate ujis_bin); +select locate('he','hello'); +select locate('he','hello',2); +select locate('lo','hello',2); +select locate('HE','hello'); +select locate('HE','hello',2); +select locate('LO','hello',2); +select locate('HE','hello' collate ujis_bin); +select locate('HE','hello' collate ujis_bin,2); +select locate('LO','hello' collate ujis_bin,2); +select locate(_ujis 0xa1a3,_ujis 0xa1a2a1a3); + +select 0xa1a2a1a3 like concat(_binary'%',0xa2a1,_binary'%'); +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%'); +select _ujis 0xa1a2a1a3 like concat(_ujis'%',_ujis 0xa2a1, _ujis'%') collate ujis_bin; +select 'a' like 'a'; +select 'A' like 'a'; +select 'A' like 'a' collate ujis_bin; -- cgit v1.2.1 From 4935e67c4f1125355e1957fb7f4c070390e9ef46 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Sep 2003 16:59:14 +0500 Subject: New test for UTF8 functionality --- mysql-test/r/ctype_utf8.result | 61 ++++++++++++++++++++++++++++++++++++++++++ mysql-test/t/ctype_utf8.test | 35 ++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 mysql-test/r/ctype_utf8.result create mode 100644 mysql-test/t/ctype_utf8.test (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result new file mode 100644 index 00000000000..1f07de17b14 --- /dev/null +++ b/mysql-test/r/ctype_utf8.result @@ -0,0 +1,61 @@ +set names utf8; +select left(_utf8 0xD0B0D0B1D0B2,1); +left(_utf8 0xD0B0D0B1D0B2,1) +а +select right(_utf8 0xD0B0D0B2D0B2,1); +right(_utf8 0xD0B0D0B2D0B2,1) +в +select locate('he','hello'); +locate('he','hello') +1 +select locate('he','hello',2); +locate('he','hello',2) +0 +select locate('lo','hello',2); +locate('lo','hello',2) +4 +select locate('HE','hello'); +locate('HE','hello') +1 +select locate('HE','hello',2); +locate('HE','hello',2) +0 +select locate('LO','hello',2); +locate('LO','hello',2) +4 +select locate('HE','hello' collate utf8_bin); +locate('HE','hello' collate utf8_bin) +0 +select locate('HE','hello' collate utf8_bin,2); +locate('HE','hello' collate utf8_bin,2) +0 +select locate('LO','hello' collate utf8_bin,2); +locate('LO','hello' collate utf8_bin,2) +0 +select locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2); +locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2) +2 +select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2); +locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2) +2 +select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2); +locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2) +2 +select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin); +locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin) +0 +select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin); +locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin) +0 +select 'a' like 'a'; +'a' like 'a' +1 +select 'A' like 'a'; +'A' like 'a' +1 +select 'A' like 'a' collate utf8_bin; +'A' like 'a' collate utf8_bin +0 +select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%'); +_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%') +1 diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test new file mode 100644 index 00000000000..46359e84f1d --- /dev/null +++ b/mysql-test/t/ctype_utf8.test @@ -0,0 +1,35 @@ +# +# Tests with the utf8 character set +# + +set names utf8; + +select left(_utf8 0xD0B0D0B1D0B2,1); +select right(_utf8 0xD0B0D0B2D0B2,1); + +select locate('he','hello'); +select locate('he','hello',2); +select locate('lo','hello',2); +select locate('HE','hello'); +select locate('HE','hello',2); +select locate('LO','hello',2); +select locate('HE','hello' collate utf8_bin); +select locate('HE','hello' collate utf8_bin,2); +select locate('LO','hello' collate utf8_bin,2); + +select locate(_utf8 0xD0B1, _utf8 0xD0B0D0B1D0B2); +select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2); +select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2); +select locate(_utf8 0xD091, _utf8 0xD0B0D0B1D0B2 collate utf8_bin); +select locate(_utf8 0xD0B1, _utf8 0xD0B0D091D0B2 collate utf8_bin); + +select 'a' like 'a'; +select 'A' like 'a'; +select 'A' like 'a' collate utf8_bin; +select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%'); + +# +# Fix this, it should return 1: +# +#select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD091,_utf8 '%'); +# -- cgit v1.2.1 From de826fdbfbb5093c48ce6de7e9bd8500342a7d99 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 22 Sep 2003 17:18:47 +0500 Subject: Bug 1181 fix. LIKE didn't work with UCS2 character set. --- mysql-test/r/ctype_ucs.result | 127 ++++++++++++++++++++++++++++++++++++++++++ mysql-test/t/ctype_ucs.test | 46 +++++++++++++++ 2 files changed, 173 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index ee71ffff2f0..2a0b17df043 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -13,6 +13,133 @@ hex(word) 0420 2004 DROP TABLE t1; +SET NAMES koi8r; +SET character_set_connection=ucs2; +create table t1 (a varchar(10) character set ucs2, key(a)); +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +explain select * from t1 where a like 'abc%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index +explain select * from t1 where a like concat('abc','%'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 21 NULL 1 Using where; Using index +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 +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(10) CHARACTER SET ucs2); +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 +ÆÙ×Á +æÙ×Á +Æù×Á +ÆÙ÷Á +ÆÙ×á +æù÷á +ÆÙ×ÁÐÒÏÌÄÖ +æÙ×ÁÐÒÏÌÄÖ +Æù×ÁÐÒÏÌÄÖ +ÆÙ÷ÁÐÒÏÌÄÖ +ÆÙ×áÐÒÏÌÄÖ +ÆÙ×ÁðÒÏÌÄÖ +ÆÙ×ÁÐòÏÌÄÖ +ÆÙ×ÁÐÒïÌÄÖ +ÆÙ×ÁÐÒÏìÄÖ +ÆÙ×ÁÐÒÏÌäÖ +ÆÙ×ÁÐÒÏÌÄö +æù÷áðòïìäö +SELECT * FROM t1 WHERE a LIKE 'Æù×Á%' COLLATE ucs2_bin; +a +Æù×Á +Æù×ÁÐÒÏÌÄÖ +DROP TABLE t1; +CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word)) +TYPE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci; +INSERT INTO t1 (word) VALUES ("cat"); +SELECT * FROM t1 WHERE word LIKE "c%"; +word +cat +SELECT * FROM t1 WHERE word LIKE "ca_"; +word +cat +SELECT * FROM t1 WHERE word LIKE "cat"; +word +cat +SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025'; +word +cat +SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F'; +word +cat +DROP TABLE t1; +SET NAMES latin1; CREATE TABLE t1 ( word VARCHAR(64), bar INT(11) default 0, diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index ee30baed008..80ae70c0fe2 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -29,6 +29,51 @@ INSERT INTO t1 VALUES (X'042000200020'), (X'200400200020'); SELECT hex(word) FROM t1 ORDER BY word; DROP TABLE t1; +###################################################### +# +# Test of like +# + +SET NAMES koi8r; +SET character_set_connection=ucs2; + +create table t1 (a varchar(10) character set ucs2, key(a)); +insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); +explain select * from t1 where a like 'abc%'; +explain select * from t1 where a like concat('abc','%'); +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; + +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2); +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 'Æù×Á%'; +SELECT * FROM t1 WHERE a LIKE 'Æù×Á%' COLLATE ucs2_bin; +DROP TABLE t1; + +# +# Bug 1181 +# +CREATE TABLE t1 (word varchar(64) NOT NULL, PRIMARY KEY (word)) +TYPE=MyISAM CHARACTER SET ucs2 COLLATE ucs2_general_ci; +INSERT INTO t1 (word) VALUES ("cat"); +SELECT * FROM t1 WHERE word LIKE "c%"; +SELECT * FROM t1 WHERE word LIKE "ca_"; +SELECT * FROM t1 WHERE word LIKE "cat"; +SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025'; +SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F'; +DROP TABLE t1; ###################################################### @@ -53,6 +98,7 @@ DROP TABLE t1; # are not part of the index sorted on, it does a filesort, which fails. # Using a straight index yields correct results. +SET NAMES latin1; # # Two fields, index -- cgit v1.2.1