1
by brian
clean slate |
1 |
drop table if exists t1, t2; |
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; |
|
5 |
SELECT * from t1; |
|
6 |
a b c d |
|
706
by Brian Aker
Fix loaddata test. |
7 |
2003-02-03 2003-02-03 2003-02-03 NULL |
1
by brian
clean slate |
8 |
2003-03-03 2003-03-03 2003-03-03 NULL |
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); |
|
11 |
SELECT * from t1; |
|
12 |
a b c d |
|
706
by Brian Aker
Fix loaddata test. |
13 |
NULL 2003-02-03 2003-02-03 NULL |
1
by brian
clean slate |
14 |
NULL 2003-03-03 2003-03-03 NULL |
15 |
drop table t1; |
|
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 ''''; |
|
18 |
select concat('|',a,'|'), concat('|',b,'|') from t1;
|
|
19 |
concat('|',a,'|') concat('|',b,'|')
|
|
20 |
|Field A| |Field B|
|
|
21 |
|Field 1| |Field 2'
|
|
706
by Brian Aker
Fix loaddata test. |
22 |
'Field 5' ,'Field 6|
|
1
by brian
clean slate |
23 |
|Field 6| | 'Field 7'|
|
24 |
drop table t1;
|
|
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;
|
|
27 |
select * from t1;
|
|
28 |
a b
|
|
706
by Brian Aker
Fix loaddata test. |
29 |
1 row 1
|
30 |
2 row 2
|
|
31 |
3 row 3
|
|
1
by brian
clean slate |
32 |
truncate table t1;
|
33 |
select * from t1;
|
|
34 |
a b
|
|
35 |
drop table t1;
|
|
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);
|
|
38 |
select * from t1;
|
|
39 |
a b
|
|
40 |
field1 field2
|
|
41 |
a"b cd"ef
|
|
42 |
a"b c"d"e
|
|
43 |
drop table t1;
|
|
44 |
CREATE TABLE t1 (
|
|
45 |
id INT AUTO_INCREMENT PRIMARY KEY,
|
|
46 |
c1 VARCHAR(255)
|
|
47 |
);
|
|
48 |
CREATE TABLE t2 (
|
|
49 |
id INT,
|
|
50 |
c2 VARCHAR(255)
|
|
51 |
);
|
|
52 |
INSERT INTO t1 (c1) VALUES
|
|
53 |
('r'), ('rr'), ('rrr'), ('rrrr'),
|
|
54 |
('.r'), ('.rr'), ('.rrr'), ('.rrrr'),
|
|
55 |
('r.'), ('rr.'), ('rrr.'), ('rrrr.'),
|
|
56 |
('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.');
|
|
57 |
SELECT * FROM t1;
|
|
58 |
id c1
|
|
59 |
1 r
|
|
60 |
2 rr
|
|
61 |
3 rrr
|
|
62 |
4 rrrr
|
|
63 |
5 .r
|
|
64 |
6 .rr
|
|
65 |
7 .rrr
|
|
66 |
8 .rrrr
|
|
67 |
9 r.
|
|
68 |
10 rr.
|
|
69 |
11 rrr.
|
|
70 |
12 rrrr.
|
|
71 |
13 .r.
|
|
72 |
14 .rr.
|
|
73 |
15 .rrr.
|
|
74 |
16 .rrrr.
|
|
75 |
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1;
|
|
76 |
r1r rrrr
|
|
77 |
r2r rrrrrr
|
|
78 |
r3r rrrrrrrr
|
|
79 |
r4r rrrrrrrrrr
|
|
80 |
r5r r.rrr
|
|
81 |
r6r r.rrrrr
|
|
82 |
r7r r.rrrrrrr
|
|
83 |
r8r r.rrrrrrrrr
|
|
84 |
r9r rrr.r
|
|
85 |
r10r rrrrr.r
|
|
86 |
r11r rrrrrrr.r
|
|
87 |
r12r rrrrrrrrr.r
|
|
88 |
r13r r.rr.r
|
|
89 |
r14r r.rrrr.r
|
|
90 |
r15r r.rrrrrr.r
|
|
91 |
r16r r.rrrrrrrr.r
|
|
92 |
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r';
|
|
93 |
SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
|
|
94 |
id c1 c2
|
|
95 |
SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
|
|
96 |
id c1 c2
|
|
97 |
DROP TABLE t1,t2;
|
|
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);
|
|
100 |
select * from t1;
|
|
101 |
a b c
|
|
102 |
NULL 20 b=10
|
|
103 |
NULL 25 b=15
|
|
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);
|
|
106 |
select * from t1;
|
|
107 |
a b c
|
|
108 |
NULL NULL oops
|
|
109 |
NULL NULL oops
|
|
110 |
truncate table t1;
|
|
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);
|
|
113 |
select * from t1;
|
|
114 |
a b c
|
|
115 |
100 10 123
|
|
116 |
100 15 123
|
|
117 |
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
|
|
118 |
select * from t1;
|
|
119 |
a b c
|
|
120 |
100 10 123
|
|
121 |
100 15 123
|
|
122 |
100 NULL NULL
|
|
123 |
100 NULL NULL
|
|
124 |
select @a, @b;
|
|
125 |
@a @b
|
|
126 |
NULL 15
|
|
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";
|
|
129 |
select * from t1;
|
|
130 |
a b c
|
|
131 |
1 2 Wow
|
|
132 |
3 4 Wow
|
|
133 |
5 6 Wow
|
|
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));
|
|
136 |
select * from t1;
|
|
137 |
a b c
|
|
138 |
1 2 1+2+123+2+NIL
|
|
139 |
3 4 3+4+123+4+NIL
|
|
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);
|
|
142 |
ERROR HY000: Can't load value from file with fixed size rows to variable
|
|
143 |
create table t2 (num int primary key, str varchar(10));
|
|
144 |
insert into t2 values (10,'Ten'), (15,'Fifteen');
|
|
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);
|
|
147 |
select * from t1;
|
|
148 |
a b c
|
|
149 |
10 NULL Ten
|
|
706
by Brian Aker
Fix loaddata test. |
150 |
15 NULL Ten
|
1
by brian
clean slate |
151 |
show variables like "secure_file_pri%";
|
152 |
Variable_name Value
|
|
153 |
secure_file_priv MYSQLTEST_VARDIR/
|
|
154 |
select @@secure_file_priv;
|
|
155 |
@@secure_file_priv
|
|
156 |
MYSQLTEST_VARDIR/
|
|
157 |
set @@secure_file_priv= 0;
|
|
158 |
ERROR HY000: Variable 'secure_file_priv' is a read only variable
|
|
159 |
truncate table t1;
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
160 |
load data infile 'DRIZZLE_TEST_DIR/t/loaddata.test' into table t1;
|
706
by Brian Aker
Fix loaddata test. |
161 |
ERROR HY000: The Drizzle server is running with the --secure-file-priv option so it cannot execute this statement
|
1
by brian
clean slate |
162 |
select * from t1;
|
163 |
a b c
|
|
319.1.1
by Grant Limberg
renamed all instances of MYSQL_ to DRIZZLE_ |
164 |
select load_file("DRIZZLE_TEST_DIR/t/loaddata.test");
|
165 |
load_file("DRIZZLE_TEST_DIR/t/loaddata.test")
|
|
1
by brian
clean slate |
166 |
NULL
|
167 |
drop table t1, t2;
|
|
168 |
create table t1(f1 int, f2 timestamp not null default current_timestamp);
|
|
169 |
create table t2(f1 int);
|
|
170 |
insert into t2 values(1),(2);
|
|
706
by Brian Aker
Fix loaddata test. |
171 |
ERROR 01000: Row 1 doesn't contain data for all columns
|
873.1.8
by Jay Pipes
Fixes Arg_comparator::can_compare_as_dates to never, ever allow bad |
172 |
select f1 from t1 where f2 IS NOT NULL order by f1;
|
1
by brian
clean slate |
173 |
f1
|
174 |
delete from t1;
|
|
706
by Brian Aker
Fix loaddata test. |
175 |
ERROR 01000: Row 1 doesn't contain data for all columns
|
873.1.8
by Jay Pipes
Fixes Arg_comparator::can_compare_as_dates to never, ever allow bad |
176 |
select f1 from t1 where f2 IS NOT NULL order by f1;
|
1
by brian
clean slate |
177 |
f1
|
178 |
drop table t1,t2;
|
|
179 |
CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
|
|
180 |
INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
|
|
181 |
SELECT * FROM t1;
|
|
182 |
c1 c2 c3 c4
|
|
183 |
10 1970-02-01 01:02:03 1.1e-100 1.1e100
|
|
184 |
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
|
|
185 |
EOF
|
|
186 |
TRUNCATE t1;
|
|
187 |
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
|
|
188 |
SELECT * FROM t1;
|
|
189 |
c1 c2 c3 c4
|
|
190 |
10 1970-02-01 01:02:03 1.1e-100 1.1e100
|
|
191 |
DROP TABLE t1;
|