Commit 1483aebe authored by Alexander Barkov's avatar Alexander Barkov

Adding tests for DATA_CHARSET and TABLE_TYPE=CSV.

modified:
  mysql-test/suite/connect/r/csv.result
  mysql-test/suite/connect/t/csv.test
parent 29cd5363
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
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment