summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authormithun <mithun.c.y@oracle.com>2014-08-12 17:16:51 +0530
committermithun <mithun.c.y@oracle.com>2014-08-12 17:16:51 +0530
commitf8893dc472570383d2445c026c1488a010865a84 (patch)
treebd50bb93b6f22cbf2b91384b383484d3fb448a2e /mysql-test
parent77a5517c93ddca99a49d051a24bd31501d4c67ce (diff)
downloadmariadb-git-f8893dc472570383d2445c026c1488a010865a84.tar.gz
Bug #11755818 : LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN
COLLATIONS ARE USED. ISSUE : ------- Code points of HALF WIDTH KATAKANA in SJIS/CP932 range from A1 to DF. In function my_wildcmp_mb_bin_impl while comparing such single byte code points, there is a code which compares signed character with unsigned character. Because of this, comparisons of two same code points representing a HALF WIDTH KATAKANA character always fails. Solution: --------- A code point of HALF WIDTH KATAKANA at-least need 8 bits. Promoting the variable from uchar to int will fix the issue. mysql-test/t/ctype_cp932.test: Tests which have conditions LIKE 'STRING PATTERN WITH HALF WIDTH KATAKANA'. strings/ctype-mb.c: A code point of HALF WIDTH KATAKANA at-least need 8 bits. Promoting the variable from uchar to int will fix the issue.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/ctype_cp932.result35
-rw-r--r--mysql-test/t/ctype_cp932.test29
2 files changed, 64 insertions, 0 deletions
diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result
new file mode 100644
index 00000000000..4b170ee4c9b
--- /dev/null
+++ b/mysql-test/r/ctype_cp932.result
@@ -0,0 +1,35 @@
+#
+# Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE
+# USED.
+#
+SET @old_character_set_client= @@character_set_client;
+SET @old_character_set_connection= @@character_set_connection;
+SET @old_character_set_results= @@character_set_results;
+SET character_set_client= 'utf8';
+SET character_set_connection= 'utf8';
+SET character_set_results= 'utf8';
+CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin);
+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
+カカ
+ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin;
+SELECT * FROM t1 WHERE a LIKE '%カ';
+a
+カカ
+SELECT * FROM t1 WHERE a LIKE '_カ';
+a
+カカ
+SELECT * FROM t1 WHERE a LIKE '%_カ';
+a
+カカ
+DROP TABLE t1;
+SET @@character_set_client= @old_character_set_client;
+SET @@character_set_connection= @old_character_set_connection;
+SET @@character_set_results= @old_character_set_results;
diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test
new file mode 100644
index 00000000000..96a2666f69b
--- /dev/null
+++ b/mysql-test/t/ctype_cp932.test
@@ -0,0 +1,29 @@
+-- source include/have_cp932.inc
+--echo #
+--echo # Bug #11755818 LIKE DOESN'T MATCH WHEN CP932_BIN/SJIS_BIN COLLATIONS ARE
+--echo # USED.
+--echo #
+
+SET @old_character_set_client= @@character_set_client;
+SET @old_character_set_connection= @@character_set_connection;
+SET @old_character_set_results= @@character_set_results;
+SET character_set_client= 'utf8';
+SET character_set_connection= 'utf8';
+SET character_set_results= 'utf8';
+
+CREATE TABLE t1 (a VARCHAR(10) COLLATE cp932_bin);
+INSERT INTO t1 VALUES('カカ');
+SELECT * FROM t1 WHERE a LIKE '%カ';
+SELECT * FROM t1 WHERE a LIKE '_カ';
+SELECT * FROM t1 WHERE a LIKE '%_カ';
+
+ALTER TABLE t1 MODIFY a VARCHAR(100) COLLATE sjis_bin;
+SELECT * FROM t1 WHERE a LIKE '%カ';
+SELECT * FROM t1 WHERE a LIKE '_カ';
+SELECT * FROM t1 WHERE a LIKE '%_カ';
+DROP TABLE t1;
+
+## Reset to initial values
+SET @@character_set_client= @old_character_set_client;
+SET @@character_set_connection= @old_character_set_connection;
+SET @@character_set_results= @old_character_set_results;