2
DROP TABLE IF EXISTS t1, t2;
6
--echo # Bug#31663 FIELDS TERMINATED BY special character
9
CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256));
10
INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
13
--let $clauses=FIELDS TERMINATED BY 'raker'
14
--echo # $clauses, warning:
16
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
17
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
18
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
19
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
20
--eval CREATE TABLE t2 SELECT $fields FROM t1
21
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
22
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
23
--eval SELECT $fields FROM t2
24
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
28
--let $clauses=FIELDS TERMINATED BY 'r'
29
--echo # Only numeric fields, $clauses, no warnings:
31
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
32
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
33
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
34
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
35
--eval CREATE TABLE t2 SELECT $fields FROM t1
36
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
37
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
38
--eval SELECT $fields FROM t2
39
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
43
--let $clauses=FIELDS TERMINATED BY '0'
44
--echo # $clauses, warning:
46
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
47
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
48
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
49
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
50
--eval CREATE TABLE t2 SELECT $fields FROM t1
51
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
52
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
53
--eval SELECT $fields FROM t2
54
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
58
--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
59
--echo # $clauses, warning:
61
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
62
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
63
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
64
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
65
--eval CREATE TABLE t2 SELECT $fields FROM t1
66
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
67
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
68
--eval SELECT $fields FROM t2
69
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
73
--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
74
--echo # Only string fields, $clauses, no warnings:
76
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
77
--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
78
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
79
--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
80
--eval CREATE TABLE t2 SELECT $fields FROM t1
81
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
82
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
83
--eval SELECT $fields FROM t2
84
--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
90
--echo # Bug#32533: SELECT INTO OUTFILE never escapes multibyte character
93
CREATE TABLE t1 (c1 VARCHAR(256));
94
INSERT INTO t1 VALUES (0xC3);
95
SELECT HEX(c1) FROM t1;
97
--let $file=$MYSQLTEST_VARDIR/tmp/bug32533.txt
99
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
100
--eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 0xC3 FROM t1
103
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
104
--eval SELECT HEX(LOAD_FILE('$file'))
106
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
107
--eval LOAD DATA INFILE '$file' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3
108
SELECT HEX(c1) FROM t1;
113
--echo # End of 5.0 tests.