diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/suite/connect/r/csv.result | 81 | ||||
-rw-r--r-- | mysql-test/suite/connect/t/csv.test | 82 |
2 files changed, 163 insertions, 0 deletions
diff --git a/mysql-test/suite/connect/r/csv.result b/mysql-test/suite/connect/r/csv.result index a6043482ff3..414371a6042 100644 --- a/mysql-test/suite/connect/r/csv.result +++ b/mysql-test/suite/connect/r/csv.result @@ -1,3 +1,4 @@ +SET NAMES utf8; # # Testing errors # @@ -142,3 +143,83 @@ REPLACE(LOAD_FILE('DATADIR/test/t2.csv'),'\r\n','\n') test1,1 test2,2 +# +# Testing international data +# +CREATE TABLE t1 +( +c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=utf8; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +c1 +á +DROP TABLE t1; +SELECT HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'));; +HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) +C3A10A +CREATE TABLE t1 +( +c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=utf8 DATA_CHARSET=latin1; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +c1 +á +DROP TABLE t1; +SELECT HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'));; +HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) +E10A +CREATE TABLE t1 +( +c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +c1 +á +DROP TABLE t1; +SELECT HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'));; +HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) +E10A +CREATE TABLE t1 +( +c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=latin1; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +c1 +á +DROP TABLE t1; +SELECT HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'));; +HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) +E10A +CREATE TABLE t1 +( +c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=latin1 DATA_CHARSET=utf8; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +c1 +á +DROP TABLE t1; +SELECT HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'));; +HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) +C3A10A +CREATE TABLE t1 +( +c1 CHAR(12) CHARACTER SET latin1, +c2 CHAR(12) CHARACTER SET utf8 +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; +INSERT INTO t1 VALUES ('á','á'); +SELECT * FROM t1; +c1 c2 +á á +DROP TABLE t1; +SELECT HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'));; +HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) +E12CC3A10A diff --git a/mysql-test/suite/connect/t/csv.test b/mysql-test/suite/connect/t/csv.test index a0909a53a55..0dea38ce465 100644 --- a/mysql-test/suite/connect/t/csv.test +++ b/mysql-test/suite/connect/t/csv.test @@ -1,6 +1,8 @@ let $MYSQLD_DATADIR= `select @@datadir`; --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/people.csv $MYSQLD_DATADIR/test/people.csv +SET NAMES utf8; + --echo # --echo # Testing errors --echo # @@ -94,6 +96,86 @@ DROP TABLE t1; --eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t2.csv'),'\r\n','\n'); --remove_file $MYSQLD_DATADIR/test/t2.csv +--echo # +--echo # Testing international data +--echo # +CREATE TABLE t1 +( + c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=utf8; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=utf8 DATA_CHARSET=latin1; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=latin1; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' + CHARSET=latin1 DATA_CHARSET=utf8; +INSERT INTO t1 VALUES ('á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + +CREATE TABLE t1 +( + c1 CHAR(12) CHARACTER SET latin1, + c2 CHAR(12) CHARACTER SET utf8 +) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; +INSERT INTO t1 VALUES ('á','á'); +SELECT * FROM t1; +DROP TABLE t1; +--chmod 0777 $MYSQLD_DATADIR/test/t1.csv +--replace_result $MYSQLD_DATADIR DATADIR +--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); +--remove_file $MYSQLD_DATADIR/test/t1.csv + # # Clean up |