~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/outfile.test

  • Committer: Stewart Smith
  • Date: 2010-02-15 01:56:32 UTC
  • mto: (1273.13.96 build)
  • mto: This revision was merged to the branch mainline in revision 1308.
  • Revision ID: stewart@flamingspork.com-20100215015632-pm7lnxfq5j5uh8kj
move DATABASE() to function plugin. modify parser so that it looks for a function named 'database' when DATABASE() is called. Special case still needed in parser due to hilarity of not-really-reserved words.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
disable_query_log;
2
 
# Server are started in "var/master-data/local", so "../../tmp" will be "var/tmp"
3
 
eval set @tmpdir="$DRIZZLETEST_VARDIR/tmp";
 
2
-- source include/test_outfile.inc
 
3
# Server are started in "var/master-data", so "../tmp" will be "var/tmp"
 
4
eval set @tmpdir="../tmp";
4
5
enable_query_log;
 
6
-- source include/have_outfile.inc
 
7
 
 
8
--disable_warnings
 
9
DROP SCHEMA IF EXISTS data_dictionary;
 
10
--enable_warnings
 
11
 
 
12
CREATE SCHEMA data_dictionary;
5
13
 
6
14
#
7
15
# test of into outfile|dumpfile
14
22
create table t1 (`a` blob);
15
23
insert into t1 values("hello world"),("Hello mars"),(NULL);
16
24
disable_query_log;
17
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
18
 
eval select * into outfile "$DRIZZLETEST_VARDIR/tmp/outfile-test.1" from t1;
 
25
eval select * into outfile "../tmp/outfile-test.1" from t1;
19
26
enable_query_log;
20
27
select load_file(concat(@tmpdir,"/outfile-test.1"));
21
28
disable_query_log;
22
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
23
 
eval select * into dumpfile "$DRIZZLETEST_VARDIR/tmp/outfile-test.2" from t1 limit 1;
 
29
eval select * into dumpfile "../tmp/outfile-test.2" from t1 limit 1;
24
30
enable_query_log;
25
31
select load_file(concat(@tmpdir,"/outfile-test.2"));
26
32
disable_query_log;
27
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
28
 
eval select * into dumpfile "$DRIZZLETEST_VARDIR/tmp/outfile-test.3" from t1 where a is null;
 
33
eval select * into dumpfile "../tmp/outfile-test.3" from t1 where a is null;
29
34
enable_query_log;
30
35
select load_file(concat(@tmpdir,"/outfile-test.3"));
31
36
 
32
37
# the following should give errors
33
38
 
34
39
disable_query_log;
35
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
36
 
--error ER_FILE_EXISTS_ERROR
37
 
eval select * into outfile "$DRIZZLETEST_VARDIR/tmp/outfile-test.1" from t1;
38
 
 
39
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
40
 
--error ER_FILE_EXISTS_ERROR
41
 
eval select * into dumpfile "$DRIZZLETEST_VARDIR/tmp/outfile-test.2" from t1;
42
 
 
43
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
44
 
--error ER_FILE_EXISTS_ERROR
45
 
eval select * into dumpfile "$DRIZZLETEST_VARDIR/tmp/outfile-test.3" from t1;
 
40
--error 1086
 
41
eval select * into outfile "../tmp/outfile-test.1" from t1;
 
42
 
 
43
--error 1086
 
44
eval select * into dumpfile "../tmp/outfile-test.2" from t1;
 
45
 
 
46
--error 1086
 
47
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
46
48
enable_query_log;
47
 
 
48
 
# The test below drastically shortens $DRIZZLETEST_VARDIR
49
 
# to just VAR and uses a less informative file name
50
 
# This is done to accomodate longer file paths
51
 
# We were seeing error message truncation when
52
 
# the path to the server under test was long (110+ chars)
53
 
 
54
 
--disable_query_log
55
 
let $bad_test_file ="$DRIZZLETEST_VARDIR/tmp/bad";
56
 
--enable_query_log
57
 
let $replace_substring = `SELECT SUBSTRING($bad_test_file,1,128)`;
58
 
--replace_result $replace_substring DRIZZLETEST_BAD_FILE $bad_test_file DRIZZLETEST_BAD_FILE
59
 
--error ER_TEXTFILE_NOT_READABLE
60
 
eval select load_file($bad_test_file);
61
 
--remove_file $DRIZZLETEST_VARDIR/tmp/outfile-test.1
62
 
--remove_file $DRIZZLETEST_VARDIR/tmp/outfile-test.2
63
 
--remove_file $DRIZZLETEST_VARDIR/tmp/outfile-test.3
 
49
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
 
50
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1
 
51
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.2
 
52
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
64
53
drop table t1;
65
54
 
66
55
# Bug#8191
67
56
disable_query_log;
68
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
69
 
eval select 1 into outfile "$DRIZZLETEST_VARDIR/tmp/outfile-test.4";
 
57
eval select 1 into outfile "../tmp/outfile-test.4";
70
58
enable_query_log;
71
 
--replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR
72
59
select load_file(concat(@tmpdir,"/outfile-test.4"));
73
 
--remove_file $DRIZZLETEST_VARDIR/tmp/outfile-test.4
 
60
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
74
61
 
75
62
#
76
63
# Bug #5382: 'explain select into outfile' crashes the server
77
64
#
78
65
 
79
66
CREATE TABLE t1 (a INT);
80
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
81
 
eval EXPLAIN SELECT * INTO OUTFILE '$DRIZZLETEST_VARDIR/tmp/t1.txt' 
 
67
EXPLAIN 
 
68
  SELECT *
 
69
  INTO OUTFILE '/tmp/t1.txt'
82
70
  FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
83
71
  FROM t1;
84
72
DROP TABLE t1;
89
77
# Bug#13202  SELECT * INTO OUTFILE ... FROM data_dictionary.schemas now fails
90
78
#
91
79
disable_query_log;
92
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
93
 
eval SELECT * INTO OUTFILE "$DRIZZLETEST_VARDIR/tmp/outfile-test.4"
 
80
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
94
81
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
95
82
FROM data_dictionary.schemas LIMIT 0, 5;
96
83
# enable_query_log;
97
 
--remove_file $DRIZZLETEST_VARDIR/tmp/outfile-test.4
 
84
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
98
85
 
99
86
use data_dictionary;
100
87
# disable_query_log;
101
 
--replace_result $DRIZZLETEST_VARDIR DRIZZLETEST_VARDIR
102
 
eval SELECT * INTO OUTFILE "$DRIZZLETEST_VARDIR/tmp/outfile-test.5"
 
88
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
103
89
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
104
90
FROM schemas LIMIT 0, 5;
105
91
enable_query_log;
106
 
--remove_file $DRIZZLETEST_VARDIR/tmp/outfile-test.5
 
92
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
107
93
use test;
108
94
 
109
95
#
112
98
# It should not be possible to write to a file outside of vardir
113
99
create table t1(a int);
114
100
--replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR
115
 
--error ER_OPTION_PREVENTS_STATEMENT
 
101
--error 1290
116
102
eval select * into outfile "$DRIZZLE_TEST_DIR/outfile-test1" from t1;
117
103
drop table t1;
 
104
 
 
105
DROP SCHEMA data_dictionary;