diff options
author | Alexander Barkov <bar@mysql.com> | 2009-05-05 11:55:22 +0500 |
---|---|---|
committer | Alexander Barkov <bar@mysql.com> | 2009-05-05 11:55:22 +0500 |
commit | 0df00705495937111ef20fa5050e90ca1e223ca3 (patch) | |
tree | 746e54f0ec1dbb6d28b263b1b7b1681c7b1887b2 | |
parent | ad7518418ca73f9ed25f5c4e45826d055d3ceac7 (diff) | |
download | mariadb-git-0df00705495937111ef20fa5050e90ca1e223ca3.tar.gz |
Bug#44352 UPPER/LOWER function doesn't work correctly
on cp932 and sjis environment.
Problem: case conversion erroneously changes the second bytes
of multi-byte sequences because single-byte functions were
called in a mistake.
Fix: call multi-byte aware functions instead.
-rw-r--r-- | mysql-test/r/ctype_cp932_binlog_stm.result | 8 | ||||
-rw-r--r-- | mysql-test/r/ctype_sjis.result | 10 | ||||
-rw-r--r-- | mysql-test/t/ctype_cp932_binlog_stm.test | 6 | ||||
-rw-r--r-- | mysql-test/t/ctype_sjis.test | 10 | ||||
-rw-r--r-- | strings/ctype-cp932.c | 8 | ||||
-rw-r--r-- | strings/ctype-sjis.c | 8 |
6 files changed, 42 insertions, 8 deletions
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index 0cd2d395ebc..2f67eb16b2e 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -46,4 +46,12 @@ master-bin.000001 1137 Query 1 1216 use `test`; DROP TABLE t4 End of 5.0 tests SHOW BINLOG EVENTS FROM 364; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error +Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment. +CREATE TABLE t1 (a varchar(16)) character set cp932; +INSERT INTO t1 VALUES (0x8372835E),(0x8352835E); +SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); +hex(a) hex(lower(a)) hex(upper(a)) +8352835E 8352835E 8352835E +8372835E 8372835E 8372835E +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index 91d6ebd9795..1469e335f23 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -209,3 +209,13 @@ SET NAMES sjis; SELECT HEX('@\') FROM DUAL; HEX('@\') 8DB2939181408C5C +# Start of 5.1 tests +Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment. +CREATE TABLE t1 (a varchar(16)) character set sjis; +INSERT INTO t1 VALUES (0x8372835E),(0x8352835E); +SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); +hex(a) hex(lower(a)) hex(upper(a)) +8352835E 8352835E 8352835E +8372835E 8372835E 8372835E +DROP TABLE t1; +# End of 5.1 tests diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test index 383009ae7c3..9e9716e5ddb 100644 --- a/mysql-test/t/ctype_cp932_binlog_stm.test +++ b/mysql-test/t/ctype_cp932_binlog_stm.test @@ -34,4 +34,10 @@ delimiter ;| --error 1220 SHOW BINLOG EVENTS FROM 364; +--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment. +CREATE TABLE t1 (a varchar(16)) character set cp932; +INSERT INTO t1 VALUES (0x8372835E),(0x8352835E); +SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test index 27cbdff451b..7de94e34dea 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -83,3 +83,13 @@ SET NAMES sjis; SELECT HEX('@\') FROM DUAL; # End of 4.1 tests + +--echo # Start of 5.1 tests + +--echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment. +CREATE TABLE t1 (a varchar(16)) character set sjis; +INSERT INTO t1 VALUES (0x8372835E),(0x8352835E); +SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); +DROP TABLE t1; + +--echo # End of 5.1 tests diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index c1aba0b35c6..07191c436b7 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -5489,10 +5489,10 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mb_wc_cp932, /* mb_wc */ my_wc_mb_cp932, /* wc_mb */ my_mb_ctype_mb, - my_caseup_str_8bit, - my_casedn_str_8bit, - my_caseup_8bit, - my_casedn_8bit, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 3925b76869c..ac426e0d7b5 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4650,10 +4650,10 @@ static MY_CHARSET_HANDLER my_charset_handler= my_mb_wc_sjis, /* mb_wc */ my_wc_mb_sjis, /* wc_mb */ my_mb_ctype_mb, - my_caseup_str_8bit, - my_casedn_str_8bit, - my_caseup_8bit, - my_casedn_8bit, + my_caseup_str_mb, + my_casedn_str_mb, + my_caseup_mb, + my_casedn_mb, my_snprintf_8bit, my_long10_to_str_8bit, my_longlong10_to_str_8bit, |