~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/loaddata.result

  • Committer: patrick crews
  • Date: 2010-10-26 01:31:08 UTC
  • mfrom: (1878.7.1 drizzle)
  • mto: (1902.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1903.
  • Revision ID: gleebix@gmail.com-20101026013108-t2c3nokk4k8a7sxk
Updated tests to use variable vardir rather than a hard-coded one

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 '../../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;
 
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;
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 '../../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
 
10
load data infile 'DRIZZLETEST_VARDIR/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 '../../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
 
17
load data infile 'DRIZZLETEST_VARDIR/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 '../../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
 
26
load data infile 'DRIZZLETEST_VARDIR/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 '../../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
 
37
load data infile 'DRIZZLETEST_VARDIR/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
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 '../../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
 
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);
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 '../../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
 
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);
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 '../../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
 
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);
113
113
select * from t1;
114
114
a       b       c
115
115
100     10      123
116
116
100     15      123
117
 
load data infile '../../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
 
117
load data infile 'DRIZZLETEST_VARDIR/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 '../../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
 
128
load data infile 'DRIZZLETEST_VARDIR/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 '../../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 '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));
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 '../../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
 
141
load data infile 'DRIZZLETEST_VARDIR/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 '../../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 'DRIZZLETEST_VARDIR/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