~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/loaddata.result

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
drop table if exists t1, t2;
2
2
create table t1 (a date, b date, c date not null, d date);
3
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
4
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
 
3
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
 
4
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
5
5
SELECT * from t1;
6
6
a       b       c       d
7
7
2003-02-03      2003-02-03      2003-02-03      NULL
8
8
2003-03-03      2003-03-03      2003-03-03      NULL
9
9
truncate table t1;
10
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
 
10
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
11
11
SELECT * from t1;
12
12
a       b       c       d
13
13
NULL    2003-02-03      2003-02-03      NULL
14
14
NULL    2003-03-03      2003-03-03      NULL
15
15
drop table t1;
16
16
create table t1 (a text, b text);
17
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
 
17
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
18
18
select concat('|',a,'|'), concat('|',b,'|') from t1;
19
19
concat('|',a,'|')       concat('|',b,'|')
20
20
|Field A|       |Field B|
23
23
|Field 6|       | 'Field 7'|
24
24
drop table t1;
25
25
create table t1 (a int, b char(10));
26
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
 
26
load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
27
27
select * from t1;
28
28
a       b
29
29
1       row 1     
34
34
a       b
35
35
drop table t1;
36
36
create table t1 (a varchar(20), b varchar(20));
37
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
 
37
load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
38
38
select * from t1;
39
39
a       b
40
40
field1  field2
72
72
14      .rr.
73
73
15      .rrr.
74
74
16      .rrrr.
75
 
SELECT * INTO OUTFILE 'DRIZZLETEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
 
75
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
76
76
r1r     rrrr
77
77
r2r     rrrrrr
78
78
r3r     rrrrrrrr
89
89
r14r    r.rrrr.r
90
90
r15r    r.rrrrrr.r
91
91
r16r    r.rrrrrrrr.r
92
 
LOAD DATA INFILE 'DRIZZLETEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
 
92
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
93
93
SELECT t1.id, c1, c2 FROM t1 LEFT  JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
94
94
id      c1      c2
95
95
SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
96
96
id      c1      c2
97
97
DROP TABLE t1,t2;
98
98
create table t1 (a int default 100, b int, c varchar(60));
99
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
 
99
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
100
100
select * from t1;
101
101
a       b       c
102
102
NULL    20      b=10
103
103
NULL    25      b=15
104
104
truncate table t1;
105
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
 
105
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
106
106
select * from t1;
107
107
a       b       c
108
108
NULL    NULL    oops
109
109
NULL    NULL    oops
110
110
truncate table t1;
111
111
set @c:=123;
112
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
 
112
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
113
113
select * from t1;
114
114
a       b       c
115
115
100     10      123
116
116
100     15      123
117
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
 
117
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
118
118
select * from t1;
119
119
a       b       c
120
120
100     10      123
125
125
@a      @b
126
126
NULL    15
127
127
truncate table t1;
128
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
 
128
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
129
129
select * from t1;
130
130
a       b       c
131
131
1       2       Wow
132
132
3       4       Wow
133
133
5       6       Wow
134
134
truncate table t1;
135
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
 
135
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
136
136
select * from t1;
137
137
a       b       c
138
138
1       2       1+2+123+2+NIL
139
139
3       4       3+4+123+4+NIL
140
140
5       6       5+6+123+6+NIL
141
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
 
141
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
142
142
ERROR HY000: Can't load value from file with fixed size rows to variable
143
143
create table t2 (num int primary key, str varchar(10));
144
144
insert into t2 values (10,'Ten'), (15,'Fifteen');
145
145
truncate table t1;
146
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
 
146
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
147
147
select * from t1;
148
148
a       b       c
149
149
10      NULL    Ten
150
150
15      NULL    Ten
151
151
show variables like "secure_file_pri%";
152
152
Variable_name   Value
153
 
secure_file_priv        DRIZZLETEST_VARDIR
 
153
secure_file_priv        MYSQLTEST_VARDIR/
154
154
select @@secure_file_priv;
155
155
@@secure_file_priv
156
 
DRIZZLETEST_VARDIR
 
156
MYSQLTEST_VARDIR/
157
157
set @@secure_file_priv= 0;
158
158
ERROR HY000: Variable 'secure_file_priv' is a read only variable
159
159
truncate table t1;
162
162
select * from t1;
163
163
a       b       c
164
164
select load_file("DRIZZLE_TEST_DIR/t/loaddata.test");
165
 
ERROR HY000: The Drizzle server is running with the --secure-file-priv option so it cannot execute this statement
 
165
load_file("DRIZZLE_TEST_DIR/t/loaddata.test")
 
166
NULL
166
167
drop table t1, t2;
167
168
create table t1(f1 int, f2 timestamp not null default current_timestamp);
168
169
create table t2(f1 int);
180
181
SELECT * FROM t1;
181
182
c1      c2      c3      c4
182
183
10      1970-02-01 01:02:03     1.1e-100        1.1e100
183
 
SELECT * INTO OUTFILE 'DRIZZLETEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
 
184
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
184
185
EOF
185
186
TRUNCATE t1;
186
 
LOAD DATA INFILE 'DRIZZLETEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
 
187
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
187
188
SELECT * FROM t1;
188
189
c1      c2      c3      c4
189
190
10      1970-02-01 01:02:03     1.1e-100        1.1e100