You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
349 lines
12 KiB
349 lines
12 KiB
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1, t2;
|
|
--enable_warnings
|
|
|
|
--echo #
|
|
--echo # Bug#31663 FIELDS TERMINATED BY special character
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256));
|
|
INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
|
|
|
|
--let $fields=*
|
|
--let $clauses=FIELDS TERMINATED BY 'raker'
|
|
--echo # $clauses, warning:
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
|
|
--enable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
|
|
--eval CREATE TABLE t2 SELECT $fields FROM t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' IGNORE INTO TABLE t2 $clauses
|
|
--eval SELECT $fields FROM t2
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
|
|
DROP TABLE t2;
|
|
|
|
--let $fields=i1, i2
|
|
--let $clauses=FIELDS TERMINATED BY 'r'
|
|
--echo # Only numeric fields, $clauses, no warnings:
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
|
|
--eval CREATE TABLE t2 SELECT $fields FROM t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
|
|
--eval SELECT $fields FROM t2
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
|
|
DROP TABLE t2;
|
|
|
|
--let $fields=*
|
|
--let $clauses=FIELDS TERMINATED BY '0'
|
|
--echo # $clauses, warning:
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
|
|
--enable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
|
|
--eval CREATE TABLE t2 SELECT $fields FROM t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' IGNORE INTO TABLE t2 $clauses
|
|
--eval SELECT $fields FROM t2
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
|
|
DROP TABLE t2;
|
|
|
|
--let $fields=*
|
|
--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
|
|
--echo # $clauses, warning:
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
|
|
--enable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
|
|
--eval CREATE TABLE t2 SELECT $fields FROM t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' IGNORE INTO TABLE t2 $clauses
|
|
--eval SELECT $fields FROM t2
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
|
|
DROP TABLE t2;
|
|
|
|
--let $fields=c1, c2
|
|
--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
|
|
--echo # Only string fields, $clauses, no warnings:
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
|
|
--eval CREATE TABLE t2 SELECT $fields FROM t1
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' IGNORE INTO TABLE t2 $clauses
|
|
--eval SELECT $fields FROM t2
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
|
|
DROP TABLE t2;
|
|
|
|
DROP TABLE t1;
|
|
|
|
--echo #
|
|
--echo # Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (c1 VARCHAR(256) charset latin1);
|
|
INSERT INTO t1 VALUES (0xC3);
|
|
SELECT HEX(c1) FROM t1;
|
|
|
|
--let $file=$MYSQLTEST_VARDIR/tmp/bug32533.txt
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 0xC3 FROM t1
|
|
--enable_warnings
|
|
TRUNCATE t1;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT HEX(LOAD_FILE('$file'))
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t1 CHARACTER SET latin1 FIELDS ENCLOSED BY 0xC3
|
|
--enable_warnings
|
|
SELECT HEX(c1) FROM t1;
|
|
|
|
--remove_file $file
|
|
DROP TABLE t1;
|
|
|
|
--echo # End of 5.0 tests.
|
|
|
|
###########################################################################
|
|
|
|
--echo #
|
|
--echo # Bug #30946: mysqldump silently ignores --default-character-set
|
|
--echo # when used with --tab
|
|
--echo #
|
|
--echo # Also see mysqldump.test
|
|
--echo #
|
|
|
|
SET NAMES utf8;
|
|
CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
|
|
CREATE TABLE t2 LIKE t1;
|
|
INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
|
|
|
|
--let $file=$MYSQLTEST_VARDIR/tmp/t1.txt
|
|
|
|
|
|
--echo # Error on multi-character ENCLOSED/ESCAPED BY
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--error ER_WRONG_FIELD_TERMINATORS
|
|
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY '12345'
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--error ER_WRONG_FIELD_TERMINATORS
|
|
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY '12345'
|
|
|
|
--echo # "Not implemented" warning on multibyte ENCLOSED/ESCAPED BY character,
|
|
--echo # LOAD DATA rises error or has unpredictable result -- to be fixed later
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY 'ъ'
|
|
--enable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
# backward compatibility
|
|
--error ER_WRONG_FIELD_TERMINATORS
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ъ'
|
|
--remove_file $file
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY 'ъ'
|
|
--enable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
# backward compatibility
|
|
--error ER_WRONG_FIELD_TERMINATORS
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ъ'
|
|
--remove_file $file
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS TERMINATED BY 'ъ'
|
|
--enable_warnings
|
|
--echo ##################################################
|
|
--cat_file $file
|
|
--echo ##################################################
|
|
TRUNCATE t2;
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ'
|
|
--enable_warnings
|
|
--remove_file $file
|
|
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * FROM t1 INTO OUTFILE '$file' LINES STARTING BY 'ъ'
|
|
--enable_warnings
|
|
--echo ##################################################
|
|
--cat_file $file
|
|
--echo ##################################################
|
|
TRUNCATE t2;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ъ'
|
|
--remove_file $file
|
|
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
|
|
|
# Disabled by WL#5094
|
|
--disable_warnings
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * FROM t1 INTO OUTFILE '$file' LINES TERMINATED BY 'ъ'
|
|
--enable_warnings
|
|
--echo ##################################################
|
|
--cat_file $file
|
|
--echo ##################################################
|
|
TRUNCATE t2;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ъ'
|
|
--remove_file $file
|
|
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
|
|
--echo # Default (binary) charset:
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * INTO OUTFILE '$file' FROM t1
|
|
--echo ##################################################
|
|
--cat_file $file
|
|
--echo ##################################################
|
|
TRUNCATE t2;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
|
|
--remove_file $file
|
|
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
|
|
|
|
|
--echo # latin1 charset (INTO OUTFILE warning is expected):
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * INTO OUTFILE '$file' CHARACTER SET latin1 FROM t1
|
|
--echo ##################################################
|
|
--cat_file $file
|
|
--echo ##################################################
|
|
TRUNCATE t2;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
|
|
--remove_file $file
|
|
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
|
|
|
|
|
--echo # KOI8-R charset (INTO OUTFILE warning is expected):
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * INTO OUTFILE '$file' CHARACTER SET koi8r FROM t1
|
|
--echo ##################################################
|
|
--cat_file $file
|
|
--echo ##################################################
|
|
TRUNCATE t2;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
|
|
--remove_file $file
|
|
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
|
|
|
|
|
--echo # UTF-8 charset:
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * INTO OUTFILE '$file' CHARACTER SET utf8 FROM t1
|
|
--echo ##################################################
|
|
--cat_file $file
|
|
--echo ##################################################
|
|
TRUNCATE t2;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
|
|
--remove_file $file
|
|
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
|
|
|
|
|
|
SET NAMES default;
|
|
|
|
DROP TABLE t1, t2;
|
|
###########################################################################
|
|
|
|
--echo #
|
|
--echo # Bug #53088: mysqldump with -T & --default-character-set set
|
|
--echo # truncates text/blob to 766 chars
|
|
--echo #
|
|
--echo # Also see mysqldump.test
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (a BLOB) CHARSET latin1;
|
|
CREATE TABLE t2 LIKE t1;
|
|
|
|
let $file= '$MYSQLTEST_VARDIR/tmp/bug53088.txt';
|
|
let $length= 800;
|
|
|
|
--eval INSERT INTO t1 VALUES (REPEAT('.', $length))
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * INTO OUTFILE $file CHARACTER SET latin1 FROM t1
|
|
|
|
--echo # should be greater than $length
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT LENGTH(LOAD_FILE($file))
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval LOAD DATA INFILE $file INTO TABLE t2
|
|
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug53088.txt
|
|
|
|
--echo # should be $length
|
|
SELECT LENGTH(a) FROM t2;
|
|
|
|
DROP TABLE t1, t2;
|
|
|
|
|
|
###########################################################################
|
|
--echo # End of 5.1 tests.
|
|
|
|
|
|
--echo #
|
|
--echo # Bug#24577194 - LOAD DATA ERROR 1262 BEHAVIOUR DIFFERENT
|
|
--echo # BETWEEN 5.6 AND 5.7 UNDER STRICT SQLMOD
|
|
--echo #
|
|
CREATE TABLE t1(c1 VARCHAR(10), c2 VARCHAR(10));
|
|
INSERT INTO t1 VALUES('aaaaa', 'bbbbb');
|
|
|
|
let $file= '$MYSQLTEST_VARDIR/tmp/bug24577194.txt';
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--eval SELECT * FROM t1 INTO OUTFILE $file FIELDS TERMINATED BY ','
|
|
|
|
CREATE TABLE t2(c1 VARCHAR(10));
|
|
SET sql_mode='STRICT_ALL_TABLES';
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--error ER_WARN_TOO_MANY_RECORDS
|
|
--eval LOAD DATA INFILE $file INTO TABLE t2 FIELDS TERMINATED BY ','
|
|
DROP TABLE t1,t2;
|
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug24577194.txt
|
|
SET sql_mode=default;
|
|
|