~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/outfile.test

Coupla small include cleanups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
disable_query_log;
2
 
# Server are started in "var/master-data", so "../tmp" will be "var/tmp"
3
 
eval set @tmpdir="../tmp";
4
 
enable_query_log;
5
 
 
6
 
#
7
 
# test of into outfile|dumpfile
8
 
#
9
 
 
10
 
--disable_warnings
11
 
drop table if exists t1;
12
 
--enable_warnings
13
 
 
14
 
create table t1 (`a` blob);
15
 
insert into t1 values("hello world"),("Hello mars"),(NULL);
16
 
disable_query_log;
17
 
eval select * into outfile "../tmp/outfile-test.1" from t1;
18
 
enable_query_log;
19
 
select load_file(concat(@tmpdir,"/outfile-test.1"));
20
 
disable_query_log;
21
 
eval select * into dumpfile "../tmp/outfile-test.2" from t1 limit 1;
22
 
enable_query_log;
23
 
select load_file(concat(@tmpdir,"/outfile-test.2"));
24
 
disable_query_log;
25
 
eval select * into dumpfile "../tmp/outfile-test.3" from t1 where a is null;
26
 
enable_query_log;
27
 
select load_file(concat(@tmpdir,"/outfile-test.3"));
28
 
 
29
 
# the following should give errors
30
 
 
31
 
disable_query_log;
32
 
--error 1086
33
 
eval select * into outfile "../tmp/outfile-test.1" from t1;
34
 
 
35
 
--error 1086
36
 
eval select * into dumpfile "../tmp/outfile-test.2" from t1;
37
 
 
38
 
--error 1086
39
 
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
40
 
enable_query_log;
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
45
 
drop table t1;
46
 
 
47
 
# Bug#8191
48
 
disable_query_log;
49
 
eval select 1 into outfile "../tmp/outfile-test.4";
50
 
enable_query_log;
51
 
select load_file(concat(@tmpdir,"/outfile-test.4"));
52
 
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
53
 
 
54
 
#
55
 
# Bug #5382: 'explain select into outfile' crashes the server
56
 
#
57
 
 
58
 
CREATE TABLE t1 (a INT);
59
 
EXPLAIN 
60
 
  SELECT *
61
 
  INTO OUTFILE '/tmp/t1.txt'
62
 
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
63
 
  FROM t1;
64
 
DROP TABLE t1;
65
 
 
66
 
# End of 4.1 tests
67
 
 
68
 
#
69
 
# Bug#13202  SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
70
 
#
71
 
disable_query_log;
72
 
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
73
 
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
74
 
FROM information_schema.schemata LIMIT 0, 5;
75
 
# enable_query_log;
76
 
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
77
 
 
78
 
use information_schema;
79
 
# disable_query_log;
80
 
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
81
 
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
82
 
FROM schemata LIMIT 0, 5;
83
 
enable_query_log;
84
 
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
85
 
use test;
86
 
 
87
 
#
88
 
# Bug#18628 mysql-test-run: security problem
89
 
#
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 1290
94
 
eval select * into outfile "$DRIZZLE_TEST_DIR/outfile-test1" from t1;
95
 
drop table t1;
96
 
 
97
 
#
98
 
# Bug#28181 Access denied to 'information_schema when
99
 
# select into out file (regression)
100
 
#
101
 
create database mysqltest;
102
 
create user user_1@localhost;
103
 
grant all on mysqltest.* to user_1@localhost;
104
 
connect (con28181_1,localhost,user_1,,mysqltest);
105
 
 
106
 
--error ER_ACCESS_DENIED_ERROR 
107
 
eval select schema_name
108
 
into outfile "../tmp/outfile-test.4"
109
 
fields terminated by ',' optionally enclosed by '"'
110
 
 lines terminated by '\n'
111
 
from information_schema.schemata
112
 
where schema_name like 'mysqltest';
113
 
 
114
 
connection default;
115
 
grant file on *.* to user_1@localhost;
116
 
 
117
 
connect (con28181_2,localhost,user_1,,mysqltest);
118
 
eval select schema_name
119
 
into outfile "../tmp/outfile-test.4"
120
 
fields terminated by ',' optionally enclosed by '"'
121
 
 lines terminated by '\n'
122
 
from information_schema.schemata
123
 
where schema_name like 'mysqltest';
124
 
 
125
 
connection default;
126
 
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
127
 
use test;
128
 
revoke all privileges on *.* from user_1@localhost;
129
 
drop user user_1@localhost;
130
 
drop database mysqltest;
131