summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@bar.intranet.mysql.r18.ru>2003-12-24 16:59:48 +0400
committerunknown <bar@bar.intranet.mysql.r18.ru>2003-12-24 16:59:48 +0400
commit4bff43a7244cedb45f99c812596a6527d3808c43 (patch)
tree970f2a8c8f69a48849996de5dfe4e5f5d8a20c1d
parent56f484056355118e8ae5f5f22a45b3e3a64db885 (diff)
downloadmariadb-git-4bff43a7244cedb45f99c812596a6527d3808c43.tar.gz
"like" did not work in some cases with character set big5
-rw-r--r--mysql-test/include/have_big5.inc4
-rw-r--r--mysql-test/r/ctype_big5.result10
-rw-r--r--mysql-test/r/have_big5.require2
-rw-r--r--mysql-test/t/ctype_big5.test18
-rw-r--r--strings/ctype-big5.c2
5 files changed, 35 insertions, 1 deletions
diff --git a/mysql-test/include/have_big5.inc b/mysql-test/include/have_big5.inc
new file mode 100644
index 00000000000..790e8085e1a
--- /dev/null
+++ b/mysql-test/include/have_big5.inc
@@ -0,0 +1,4 @@
+-- require r/have_big5.require
+disable_query_log;
+show collation like "big5_chinese_ci";
+enable_query_log;
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
new file mode 100644
index 00000000000..44fad0cd96a
--- /dev/null
+++ b/mysql-test/r/ctype_big5.result
@@ -0,0 +1,10 @@
+drop table if exists t1;
+SET NAMES big5;
+CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT * FROM t1 WHERE c LIKE 'aaa%';
+c
+aaa
+aaaa
+aaaaa
+DROP TABLE t1;
diff --git a/mysql-test/r/have_big5.require b/mysql-test/r/have_big5.require
new file mode 100644
index 00000000000..74aacf74b62
--- /dev/null
+++ b/mysql-test/r/have_big5.require
@@ -0,0 +1,2 @@
+Collation Charset Id Default Compiled Sortlen
+big5_chinese_ci big5 1 Yes Yes 1
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
new file mode 100644
index 00000000000..9bf1808636e
--- /dev/null
+++ b/mysql-test/t/ctype_big5.test
@@ -0,0 +1,18 @@
+-- source include/have_big5.inc
+
+#
+# Tests with the big5 character set
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+SET NAMES big5;
+
+#
+# Bug 1883: LIKE did not work in some cases with a key.
+#
+CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT * FROM t1 WHERE c LIKE 'aaa%';
+DROP TABLE t1;
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 85f066c4eba..c5ddc167d0d 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -377,7 +377,7 @@ static my_bool my_like_range_big5(CHARSET_INFO *cs __attribute__((unused)),
*min_length= (uint) (min_str-min_org);
*max_length= res_length;
do {
- *min_str++ = '\0'; /* Because if key compression */
+ *min_str++ = ' '; /* Because if key compression */
*max_str++ = max_sort_char;
} while (min_str != min_end);
return 0;