2
# Server are started in "var/master-data/local", so "../../tmp" will be "var/tmp"
3
eval set @tmpdir="../../tmp";
7
# test of into outfile|dumpfile
11
drop table if exists t1;
14
create table t1 (`a` blob);
15
insert into t1 values("hello world"),("Hello mars"),(NULL);
17
eval select * into outfile "../../tmp/outfile-test.1" from t1;
19
select load_file(concat(@tmpdir,"/outfile-test.1"));
21
eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1;
23
select load_file(concat(@tmpdir,"/outfile-test.2"));
25
eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null;
27
select load_file(concat(@tmpdir,"/outfile-test.3"));
29
# the following should give errors
32
--error ER_FILE_EXISTS_ERROR
33
eval select * into outfile "../../tmp/outfile-test.1" from t1;
35
--error ER_FILE_EXISTS_ERROR
36
eval select * into dumpfile "../../tmp/outfile-test.2" from t1;
38
--error ER_FILE_EXISTS_ERROR
39
eval select * into dumpfile "../../tmp/outfile-test.3" from t1;
41
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
42
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1
43
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.2
44
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
49
eval select 1 into outfile "../../tmp/outfile-test.4";
51
select load_file(concat(@tmpdir,"/outfile-test.4"));
52
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
55
# Bug #5382: 'explain select into outfile' crashes the server
58
CREATE TABLE t1 (a INT);
61
INTO OUTFILE '../../tmp/t1.txt'
62
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
69
# Bug#13202 SELECT * INTO OUTFILE ... FROM data_dictionary.schemas now fails
72
eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
73
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
74
FROM data_dictionary.schemas LIMIT 0, 5;
76
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
80
eval SELECT * INTO OUTFILE "../../tmp/outfile-test.5"
81
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
82
FROM schemas LIMIT 0, 5;
84
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.5
88
# Bug#18628 mysql-test-run: security problem
90
# It should not be possible to write to a file outside of vardir
91
create table t1(a int);
92
--replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR
93
--error ER_OPTION_PREVENTS_STATEMENT
94
eval select * into outfile "$DRIZZLE_TEST_DIR/outfile-test1" from t1;