diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-04-02 00:18:58 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2016-04-02 00:18:58 +0400 |
commit | e975cd0ba90280e98556764c4fbdae74addd870f (patch) | |
tree | cc8b44dd3122504ac8116c74c55cab87a80f87d3 | |
parent | 3fc6a8b832fd152f1fbabff08273e0223c0ff0ab (diff) | |
download | mariadb-git-e975cd0ba90280e98556764c4fbdae74addd870f.tar.gz |
MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis
-rw-r--r-- | mysql-test/r/ctype_sjis.result | 18 | ||||
-rw-r--r-- | mysql-test/std_data/loaddata/mdev9842.txt | 1 | ||||
-rw-r--r-- | mysql-test/t/ctype_sjis.test | 18 | ||||
-rw-r--r-- | sql/sql_load.cc | 3 |
4 files changed, 39 insertions, 1 deletions
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index 46686933298..e96a54211dc 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -18730,3 +18730,21 @@ DROP TABLE t1; # # End of 10.0 tests # +# +# Start of 10.2 tests +# +# +# MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis +# +CREATE TABLE t1 (a TEXT CHARACTER SET sjis); +LOAD DATA INFILE '../../std_data/loaddata/mdev9842.txt' INTO TABLE t1 CHARACTER SET sjis; +SELECT HEX(a) FROM t1; +HEX(a) +78835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C835C +SELECT a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) FROM t1; +a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) +1 +DROP TABLE t1; +# +# End of 10.2 tests +# diff --git a/mysql-test/std_data/loaddata/mdev9842.txt b/mysql-test/std_data/loaddata/mdev9842.txt new file mode 100644 index 00000000000..1aed9a9a905 --- /dev/null +++ b/mysql-test/std_data/loaddata/mdev9842.txt @@ -0,0 +1 @@ +xソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソソ diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test index 2777cf6a035..5cc7d9a858d 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -231,3 +231,21 @@ SET NAMES sjis; --echo # --echo # End of 10.0 tests --echo # + +--echo # +--echo # Start of 10.2 tests +--echo # + +--echo # +--echo # MDEV-9842 LOAD DATA INFILE does not work well with a TEXT column when using sjis +--echo # +CREATE TABLE t1 (a TEXT CHARACTER SET sjis); +LOAD DATA INFILE '../../std_data/loaddata/mdev9842.txt' INTO TABLE t1 CHARACTER SET sjis; +SELECT HEX(a) FROM t1; +SELECT a=CONCAT('x', REPEAT(_sjis 0x835C, 200)) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # End of 10.2 tests +--echo # diff --git a/sql/sql_load.cc b/sql/sql_load.cc index f1c29203f3e..ed8c4d8d53d 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -1492,7 +1492,8 @@ int READ_INFO::read_field() for (;;) { - while ( to < end_of_buff) + // Make sure we have enough space for the longest multi-byte character. + while ( to + read_charset->mbmaxlen <= end_of_buff) { chr = GET; if (chr == my_b_EOF) |