diff --git a/mysql-test/include/ctype_E05C.inc b/mysql-test/include/ctype_E05C.inc new file mode 100644 index 00000000000..f98cc8b0487 --- /dev/null +++ b/mysql-test/include/ctype_E05C.inc @@ -0,0 +1,94 @@ +--echo # Start of ctype_E05C.inc + +# +# A shared test for character sets big5, cp932, gbk, sjis +# They all can have 0x5C as the second byte in a multi-byte character. +# 0xE05C is one of such characters. +# + +# Checking that the character 0xE05C correctly understands 5C as the second byte +# rather than a stand-alone backslash, including the strings that also +# have real backslash escapes and/or separator escapes. + +SELECT HEX('\'),HEX('\t'); +SELECT HEX('\\\'),HEX('\\\t'),HEX('\\\t\t'); +SELECT HEX('''\'),HEX('\'''); +SELECT HEX('\\''\'),HEX('\''\\'); + +SELECT HEX(BINARY('\')),HEX(BINARY('\t')); +SELECT HEX(BINARY('\\\')),HEX(BINARY('\\\t')),HEX(BINARY('\\\t\t')); +SELECT HEX(BINARY('''\')),HEX(BINARY('\''')); +SELECT HEX(BINARY('\\''\')),HEX(BINARY('\''\\')); + +SELECT HEX(_BINARY'\'),HEX(_BINARY'\t'); +SELECT HEX(_BINARY'\\\'),HEX(_BINARY'\\\t'),HEX(_BINARY'\\\t\t'); +SELECT HEX(_BINARY'''\'),HEX(_BINARY'\'''); +SELECT HEX(_BINARY'\\''\'),HEX(_BINARY'\''\\'); + +CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +DROP TABLE t1; + +# Checking that with character_set_client=binary 0x5C in 0xE05C +# is treated as escape rather than the second byte of a multi-byte character, +# even if character_set_connection is big5/cp932/gbk/sjis. +# Note, the other 0x5C which is before 0xE05C is also treated as escape. +# +SET character_set_client=binary, character_set_results=binary; +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +SELECT HEX('\['), HEX('\\['); +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('\['),('\\['); +SELECT HEX(a) FROM t1; +DROP TABLE t1; + +--echo # Start of ctype_E05C.inc + diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index 40df0ab1024..77e6ea48d2a 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -4374,6 +4374,253 @@ DROP FUNCTION mysql_real_escape_string_generated; DROP FUNCTION iswellformed; DROP TABLE allbytes; # End of ctype_backslash.inc +SET NAMES big5; +# Start of ctype_E05C.inc +SELECT HEX('\'),HEX('\t'); +HEX('\') HEX('\t') +E05C E05C74 +SELECT HEX('\\\'),HEX('\\\t'),HEX('\\\t\t'); +HEX('\\\') HEX('\\\t') HEX('\\\t\t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX('''\'),HEX('\'''); +HEX('''\') HEX('\''') +27E05C E05C27 +SELECT HEX('\\''\'),HEX('\''\\'); +HEX('\\''\') HEX('\''\\') +5C27E05C E05C275C +SELECT HEX(BINARY('\')),HEX(BINARY('\t')); +HEX(BINARY('\')) HEX(BINARY('\t')) +E05C E05C74 +SELECT HEX(BINARY('\\\')),HEX(BINARY('\\\t')),HEX(BINARY('\\\t\t')); +HEX(BINARY('\\\')) HEX(BINARY('\\\t')) HEX(BINARY('\\\t\t')) +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(BINARY('''\')),HEX(BINARY('\''')); +HEX(BINARY('''\')) HEX(BINARY('\''')) +27E05C E05C27 +SELECT HEX(BINARY('\\''\')),HEX(BINARY('\''\\')); +HEX(BINARY('\\''\')) HEX(BINARY('\''\\')) +5C27E05C E05C275C +SELECT HEX(_BINARY'\'),HEX(_BINARY'\t'); +HEX(_BINARY'\') HEX(_BINARY'\t') +E05C E05C74 +SELECT HEX(_BINARY'\\\'),HEX(_BINARY'\\\t'),HEX(_BINARY'\\\t\t'); +HEX(_BINARY'\\\') HEX(_BINARY'\\\t') HEX(_BINARY'\\\t\t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(_BINARY'''\'),HEX(_BINARY'\'''); +HEX(_BINARY'''\') HEX(_BINARY'\''') +27E05C E05C27 +SELECT HEX(_BINARY'\\''\'),HEX(_BINARY'\''\\'); +HEX(_BINARY'\\''\') HEX(_BINARY'\''\\') +5C27E05C E05C275C +CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +SET character_set_client=binary, character_set_results=binary; +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +@@character_set_client @@character_set_connection @@character_set_results +binary big5 binary +SELECT HEX('\['), HEX('\\['); +HEX('\[') HEX('\\[') +E05B E05B +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET big5 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\['),('\\['); +SELECT HEX(a) FROM t1; +HEX(a) +E05B +E05B +DROP TABLE t1; +# Start of ctype_E05C.inc +SET NAMES big5; +CREATE TABLE t1 (a ENUM('@') CHARACTER SET big5); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('?') CHARACTER SET big5 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('@'); +INSERT INTO t1 VALUES (_big5 0xC840); +INSERT INTO t1 VALUES (0xC840); +SELECT HEX(a),a FROM t1; +HEX(a) a +C840 @ +C840 @ +C840 @ +DROP TABLE t1; +SET NAMES binary; +CREATE TABLE t1 (a ENUM('@') CHARACTER SET big5); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('?') CHARACTER SET big5 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('@'); +INSERT INTO t1 VALUES (_big5 0xC840); +INSERT INTO t1 VALUES (0xC840); +SELECT HEX(a),a FROM t1; +HEX(a) a +C840 @ +C840 @ +C840 @ +DROP TABLE t1; +SET NAMES big5; +CREATE TABLE t1 ( +c1 CHAR(10) CHARACTER SET big5, +c2 VARCHAR(10) CHARACTER SET big5, +c3 TEXT CHARACTER SET big5 +); +INSERT INTO t1 VALUES ('@','@','@'); +INSERT INTO t1 VALUES (_big5 0xC840,_big5 0xC840,_big5 0xC840); +INSERT INTO t1 VALUES (0xC840,0xC840,0xC840); +SELECT HEX(c1),HEX(c2),HEX(c3) FROM t1; +HEX(c1) HEX(c2) HEX(c3) +C840 C840 C840 +C840 C840 C840 +C840 C840 C840 +DROP TABLE t1; +SET NAMES binary; +CREATE TABLE t1 ( +c1 CHAR(10) CHARACTER SET big5, +c2 VARCHAR(10) CHARACTER SET big5, +c3 TEXT CHARACTER SET big5 +); +INSERT INTO t1 VALUES ('@','@','@'); +INSERT INTO t1 VALUES (_big5 0xC840,_big5 0xC840,_big5 0xC840); +INSERT INTO t1 VALUES (0xC840,0xC840,0xC840); +SELECT HEX(c1),HEX(c2),HEX(c3) FROM t1; +HEX(c1) HEX(c2) HEX(c3) +C840 C840 C840 +C840 C840 C840 +C840 C840 C840 +DROP TABLE t1; +SET NAMES binary; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET big5, KEY(a)); +INSERT INTO t1 VALUES (0xC840),(0xC841),(0xC842); +SELECT HEX(a) FROM t1 WHERE a='@'; +HEX(a) +C840 +SELECT HEX(a) FROM t1 IGNORE KEY(a) WHERE a='@'; +HEX(a) +C840 +DROP TABLE t1; # # End of 10.0 tests # diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index 37631f9f4bb..9b03f241bad 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -20060,3 +20060,184 @@ hex(weight_string(cast(0x814081408140 as char),25, 4, 0xC0)) # # End of 5.6 tests # +# +# Start of 10.0 tests +# +SET NAMES cp932; +# Start of ctype_E05C.inc +SELECT HEX('\'),HEX('\t'); +HEX('\') HEX('\t') +E05C E05C74 +SELECT HEX('\\\'),HEX('\\\t'),HEX('\\\t\t'); +HEX('\\\') HEX('\\\t') HEX('\\\t\t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX('''\'),HEX('\'''); +HEX('''\') HEX('\''') +27E05C E05C27 +SELECT HEX('\\''\'),HEX('\''\\'); +HEX('\\''\') HEX('\''\\') +5C27E05C E05C275C +SELECT HEX(BINARY('\')),HEX(BINARY('\t')); +HEX(BINARY('\')) HEX(BINARY('\t')) +E05C E05C74 +SELECT HEX(BINARY('\\\')),HEX(BINARY('\\\t')),HEX(BINARY('\\\t\t')); +HEX(BINARY('\\\')) HEX(BINARY('\\\t')) HEX(BINARY('\\\t\t')) +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(BINARY('''\')),HEX(BINARY('\''')); +HEX(BINARY('''\')) HEX(BINARY('\''')) +27E05C E05C27 +SELECT HEX(BINARY('\\''\')),HEX(BINARY('\''\\')); +HEX(BINARY('\\''\')) HEX(BINARY('\''\\')) +5C27E05C E05C275C +SELECT HEX(_BINARY'\'),HEX(_BINARY'\t'); +HEX(_BINARY'\') HEX(_BINARY'\t') +E05C E05C74 +SELECT HEX(_BINARY'\\\'),HEX(_BINARY'\\\t'),HEX(_BINARY'\\\t\t'); +HEX(_BINARY'\\\') HEX(_BINARY'\\\t') HEX(_BINARY'\\\t\t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(_BINARY'''\'),HEX(_BINARY'\'''); +HEX(_BINARY'''\') HEX(_BINARY'\''') +27E05C E05C27 +SELECT HEX(_BINARY'\\''\'),HEX(_BINARY'\''\\'); +HEX(_BINARY'\\''\') HEX(_BINARY'\''\\') +5C27E05C E05C275C +CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +SET character_set_client=binary, character_set_results=binary; +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +@@character_set_client @@character_set_connection @@character_set_results +binary cp932 binary +SELECT HEX('\['), HEX('\\['); +HEX('\[') HEX('\\[') +E05B E05B +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET cp932 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\['),('\\['); +SELECT HEX(a) FROM t1; +HEX(a) +E05B +E05B +DROP TABLE t1; +# Start of ctype_E05C.inc +# +# End of 10.0 tests +# diff --git a/mysql-test/r/ctype_gbk.result b/mysql-test/r/ctype_gbk.result index 22cb77e9d28..a1fcaa50ff2 100644 --- a/mysql-test/r/ctype_gbk.result +++ b/mysql-test/r/ctype_gbk.result @@ -4748,6 +4748,181 @@ DROP FUNCTION mysql_real_escape_string_generated; DROP FUNCTION iswellformed; DROP TABLE allbytes; # End of ctype_backslash.inc +SET NAMES gbk; +# Start of ctype_E05C.inc +SELECT HEX('\'),HEX('\t'); +HEX('\') HEX('\t') +E05C E05C74 +SELECT HEX('\\\'),HEX('\\\t'),HEX('\\\t\t'); +HEX('\\\') HEX('\\\t') HEX('\\\t\t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX('''\'),HEX('\'''); +HEX('''\') HEX('\''') +27E05C E05C27 +SELECT HEX('\\''\'),HEX('\''\\'); +HEX('\\''\') HEX('\''\\') +5C27E05C E05C275C +SELECT HEX(BINARY('\')),HEX(BINARY('\t')); +HEX(BINARY('\')) HEX(BINARY('\t')) +E05C E05C74 +SELECT HEX(BINARY('\\\')),HEX(BINARY('\\\t')),HEX(BINARY('\\\t\t')); +HEX(BINARY('\\\')) HEX(BINARY('\\\t')) HEX(BINARY('\\\t\t')) +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(BINARY('''\')),HEX(BINARY('\''')); +HEX(BINARY('''\')) HEX(BINARY('\''')) +27E05C E05C27 +SELECT HEX(BINARY('\\''\')),HEX(BINARY('\''\\')); +HEX(BINARY('\\''\')) HEX(BINARY('\''\\')) +5C27E05C E05C275C +SELECT HEX(_BINARY'\'),HEX(_BINARY'\t'); +HEX(_BINARY'\') HEX(_BINARY'\t') +E05C E05C74 +SELECT HEX(_BINARY'\\\'),HEX(_BINARY'\\\t'),HEX(_BINARY'\\\t\t'); +HEX(_BINARY'\\\') HEX(_BINARY'\\\t') HEX(_BINARY'\\\t\t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(_BINARY'''\'),HEX(_BINARY'\'''); +HEX(_BINARY'''\') HEX(_BINARY'\''') +27E05C E05C27 +SELECT HEX(_BINARY'\\''\'),HEX(_BINARY'\''\\'); +HEX(_BINARY'\\''\') HEX(_BINARY'\''\\') +5C27E05C E05C275C +CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +SET character_set_client=binary, character_set_results=binary; +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +@@character_set_client @@character_set_connection @@character_set_results +binary gbk binary +SELECT HEX('\['), HEX('\\['); +HEX('\[') HEX('\\[') +E05B E05B +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\['),('\\['); +SELECT HEX(a) FROM t1; +HEX(a) +E05B +E05B +DROP TABLE t1; +# Start of ctype_E05C.inc # # End of 10.0 tests # diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index ebc597acdd2..818ff8509a1 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -18311,6 +18311,181 @@ DROP FUNCTION mysql_real_escape_string_generated; DROP FUNCTION iswellformed; DROP TABLE allbytes; # End of ctype_backslash.inc +SET NAMES sjis; +# Start of ctype_E05C.inc +SELECT HEX('\'),HEX('\t'); +HEX('\') HEX('\t') +E05C E05C74 +SELECT HEX('\\\'),HEX('\\\t'),HEX('\\\t\t'); +HEX('__\') HEX('__\t') HEX('__\t_t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX('''\'),HEX('\'''); +HEX('''\') HEX('\''') +27E05C E05C27 +SELECT HEX('\\''\'),HEX('\''\\'); +HEX('__''\') HEX('\''__') +5C27E05C E05C275C +SELECT HEX(BINARY('\')),HEX(BINARY('\t')); +HEX(BINARY('\')) HEX(BINARY('\t')) +E05C E05C74 +SELECT HEX(BINARY('\\\')),HEX(BINARY('\\\t')),HEX(BINARY('\\\t\t')); +HEX(BINARY('__\')) HEX(BINARY('__\t')) HEX(BINARY('__\t_t')) +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(BINARY('''\')),HEX(BINARY('\''')); +HEX(BINARY('''\')) HEX(BINARY('\''')) +27E05C E05C27 +SELECT HEX(BINARY('\\''\')),HEX(BINARY('\''\\')); +HEX(BINARY('__''\')) HEX(BINARY('\''__')) +5C27E05C E05C275C +SELECT HEX(_BINARY'\'),HEX(_BINARY'\t'); +HEX(_BINARY'\') HEX(_BINARY'\t') +E05C E05C74 +SELECT HEX(_BINARY'\\\'),HEX(_BINARY'\\\t'),HEX(_BINARY'\\\t\t'); +HEX(_BINARY'__\') HEX(_BINARY'__\t') HEX(_BINARY'__\t_t') +5CE05C 5CE05C74 5CE05C7409 +SELECT HEX(_BINARY'''\'),HEX(_BINARY'\'''); +HEX(_BINARY'''\') HEX(_BINARY'\''') +27E05C E05C27 +SELECT HEX(_BINARY'\\''\'),HEX(_BINARY'\''\\'); +HEX(_BINARY'__''\') HEX(_BINARY'\''__') +5C27E05C E05C275C +CREATE TABLE t1 AS SELECT REPEAT(' ',10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES ('\'),('\t'); +INSERT INTO t1 VALUES ('\\\'),('\\\t'),('\\\t\t'); +INSERT INTO t1 VALUES ('''\'),('\'''); +INSERT INTO t1 VALUES ('\\''\'),('\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (BINARY('\')),(BINARY('\t')); +INSERT INTO t1 VALUES (BINARY('\\\')),(BINARY('\\\t')),(BINARY('\\\t\t')); +INSERT INTO t1 VALUES (BINARY('''\')),(BINARY('\''')); +INSERT INTO t1 VALUES (BINARY('\\''\')),(BINARY('\''\\')); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +CREATE TABLE t1 (a BLOB); +INSERT INTO t1 VALUES (_BINARY'\'),(_BINARY'\t'); +INSERT INTO t1 VALUES (_BINARY'\\\'),(_BINARY'\\\t'),(_BINARY'\\\t\t'); +INSERT INTO t1 VALUES (_BINARY'''\'),(_BINARY'\'''); +INSERT INTO t1 VALUES (_BINARY'\\''\'),(_BINARY'\''\\'); +SELECT a, HEX(a) FROM t1; +a HEX(a) +\ E05C +\t E05C74 +\\ 5CE05C +\\t 5CE05C74 +\\t 5CE05C7409 +'\ 27E05C +\' E05C27 +\'\ 5C27E05C +\'\ E05C275C +DROP TABLE t1; +SET character_set_client=binary, character_set_results=binary; +SELECT @@character_set_client, @@character_set_connection, @@character_set_results; +@@character_set_client @@character_set_connection @@character_set_results +binary sjis binary +SELECT HEX('\['), HEX('\\['); +HEX('\[') HEX('\\[') +E05B E05B +CREATE TABLE t1 AS SELECT REPEAT(' ', 10) AS a LIMIT 0; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(10) CHARACTER SET sjis NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES ('\['),('\\['); +SELECT HEX(a) FROM t1; +HEX(a) +E05B +E05B +DROP TABLE t1; +# Start of ctype_E05C.inc # # End of 10.0 tests # diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index b6507bebeb1..5c0bdff4633 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -177,6 +177,73 @@ set collation_connection=big5_bin; let $ctype_unescape_combinations=selected; --source include/ctype_unescape.inc +--character_set big5 +SET NAMES big5; +--source include/ctype_E05C.inc + + +# +# Checking unassigned character 0xC840 in an ENUM +# + +SET NAMES big5; +CREATE TABLE t1 (a ENUM('@') CHARACTER SET big5); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('@'); +INSERT INTO t1 VALUES (_big5 0xC840); +INSERT INTO t1 VALUES (0xC840); +SELECT HEX(a),a FROM t1; +DROP TABLE t1; + +SET NAMES binary; +CREATE TABLE t1 (a ENUM('@') CHARACTER SET big5); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('@'); +INSERT INTO t1 VALUES (_big5 0xC840); +INSERT INTO t1 VALUES (0xC840); +SELECT HEX(a),a FROM t1; +DROP TABLE t1; + + +# +# Checking unassigned character in CHAR, VARCHAR, TEXT +# + +SET NAMES big5; +CREATE TABLE t1 ( + c1 CHAR(10) CHARACTER SET big5, + c2 VARCHAR(10) CHARACTER SET big5, + c3 TEXT CHARACTER SET big5 +); +INSERT INTO t1 VALUES ('@','@','@'); +INSERT INTO t1 VALUES (_big5 0xC840,_big5 0xC840,_big5 0xC840); +INSERT INTO t1 VALUES (0xC840,0xC840,0xC840); +SELECT HEX(c1),HEX(c2),HEX(c3) FROM t1; +DROP TABLE t1; + +SET NAMES binary; +CREATE TABLE t1 ( + c1 CHAR(10) CHARACTER SET big5, + c2 VARCHAR(10) CHARACTER SET big5, + c3 TEXT CHARACTER SET big5 +); +INSERT INTO t1 VALUES ('@','@','@'); +INSERT INTO t1 VALUES (_big5 0xC840,_big5 0xC840,_big5 0xC840); +INSERT INTO t1 VALUES (0xC840,0xC840,0xC840); +SELECT HEX(c1),HEX(c2),HEX(c3) FROM t1; +DROP TABLE t1; + + +# +# Checking binary->big5 conversion of an unassigned character 0xC840 in optimizer +# +SET NAMES binary; +CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET big5, KEY(a)); +INSERT INTO t1 VALUES (0xC840),(0xC841),(0xC842); +SELECT HEX(a) FROM t1 WHERE a='@'; +SELECT HEX(a) FROM t1 IGNORE KEY(a) WHERE a='@'; +DROP TABLE t1; + --echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test index ca8853b9ea1..304c9f5d05c 100644 --- a/mysql-test/t/ctype_cp932_binlog_stm.test +++ b/mysql-test/t/ctype_cp932_binlog_stm.test @@ -185,3 +185,14 @@ set collation_connection=cp932_bin; --echo # --echo # End of 5.6 tests --echo # + + +--echo # +--echo # Start of 10.0 tests +--echo # +SET NAMES cp932; +--source include/ctype_E05C.inc + +--echo # +--echo # End of 10.0 tests +--echo # diff --git a/mysql-test/t/ctype_gbk.test b/mysql-test/t/ctype_gbk.test index e4f8f09940a..d44009b6109 100644 --- a/mysql-test/t/ctype_gbk.test +++ b/mysql-test/t/ctype_gbk.test @@ -195,6 +195,11 @@ set collation_connection=gbk_bin; let $ctype_unescape_combinations=selected; --source include/ctype_unescape.inc +--character_set gbk +SET NAMES gbk; +--source include/ctype_E05C.inc + + --echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test index 86e1916bc8c..ae110b20cb2 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -223,6 +223,11 @@ set collation_connection=sjis_bin; let $ctype_unescape_combinations=selected; --source include/ctype_unescape.inc +--character_set sjis +SET NAMES sjis; +--source include/ctype_E05C.inc + + --echo # --echo # End of 10.0 tests --echo #