summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mnogosearch.org>2013-02-19 16:25:59 +0400
committerAlexander Barkov <bar@mnogosearch.org>2013-02-19 16:25:59 +0400
commit1483aebeaabad0575d3a2147949b542ac414c7fd (patch)
treeb23ea5be90e604ba90c50dc1019f060ccd14b640 /mysql-test
parent29cd5363b90b0ab507be41b358415b8b79b7aec1 (diff)
downloadmariadb-git-1483aebeaabad0575d3a2147949b542ac414c7fd.tar.gz
Adding tests for DATA_CHARSET and TABLE_TYPE=CSV.
modified: mysql-test/suite/connect/r/csv.result mysql-test/suite/connect/t/csv.test
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/connect/r/csv.result81
-rw-r--r--mysql-test/suite/connect/t/csv.test82
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