25
25
load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
28
load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
30
29
# The empty line last comes from the end line field in the file
35
# Bug #12053 LOAD DATA INFILE ignores NO_AUTO_VALUE_ON_ZERO setting
37
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
38
create table t1(id integer not null auto_increment primary key);
39
insert into t1 values(0);
41
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' from t1;
43
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1;
46
remove_file $MYSQLTEST_VARDIR/tmp/t1;
49
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1'
50
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
53
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1
54
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
57
remove_file $MYSQLTEST_VARDIR/tmp/t1;
58
SET @@SQL_MODE=@OLD_SQL_MODE;
62
34
# Bug #11203: LOAD DATA does not accept same characters for ESCAPED and
128
100
truncate table t1;
129
# Reading of all columns with set
130
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
133
101
# now going to test fixed field-row file format
134
102
load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
135
103
select * from t1;
175
143
drop table t1, t2;
178
# Bug#27586: Wrong autoinc value assigned by LOAD DATA in the
179
# NO_AUTO_VALUE_ON_ZERO mode
181
create table t1(f1 int);
182
insert into t1 values(1),(null);
183
create table t2(f2 int auto_increment primary key);
185
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1;
186
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
187
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2;
190
remove_file $MYSQLTEST_VARDIR/tmp/t1;
191
SET @@SQL_MODE=@OLD_SQL_MODE;
195
146
# Bug#27670: LOAD DATA does not set CURRENT_TIMESTAMP default value for a
196
147
# TIMESTAMP field when no value has been provided.
200
151
insert into t2 values(1),(2);
201
152
disable_query_log;
202
153
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2;
203
155
eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1;
204
156
enable_query_log;
205
157
select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
209
161
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t2'
210
162
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'
212
165
eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' into table t1
213
166
FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n';
214
167
enable_query_log;
229
182
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
230
183
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
231
cat_file $MYSQLTEST_VARDIR/tmp/t1;
184
#cat_file $MYSQLTEST_VARDIR/tmp/t1;
240
193
remove_file $MYSQLTEST_VARDIR/tmp/t1;
243
###########################################################################
247
--echo # -- Bug#35469: server crash with LOAD DATA INFILE to a VIEW.
252
DROP TABLE IF EXISTS t1;
253
DROP VIEW IF EXISTS v1;
254
DROP VIEW IF EXISTS v2;
255
DROP VIEW IF EXISTS v3;
259
CREATE TABLE t1(c1 INT, c2 VARCHAR(255));
262
CREATE VIEW v1 AS SELECT * FROM t1;
263
CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1;
264
CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2;
267
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1
268
FIELDS ESCAPED BY '\\'
271
LINES TERMINATED BY '\n' (c1, c2);
283
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
284
FIELDS ESCAPED BY '\\'
287
LINES TERMINATED BY '\n' (c1, c2);
299
--error ER_LOAD_DATA_INVALID_COLUMN
300
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
301
FIELDS ESCAPED BY '\\'
304
LINES TERMINATED BY '\n' (c0, c2);
307
--error ER_NON_UPDATABLE_TABLE
308
LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3
309
FIELDS ESCAPED BY '\\'
312
LINES TERMINATED BY '\n' (d1, d2);
321
--echo # -- End of Bug#35469.
323
###########################################################################
329
# Bug#12448 LOAD DATA / SELECT INTO OUTFILE
330
# doesn't work with multibyte path name
332
CREATE TABLE t1 (a int);
333
INSERT INTO t1 VALUES (1);
335
SET character_set_filesystem=filename;
336
select @@character_set_filesystem;
337
SELECT * INTO OUTFILE 't-1' FROM t1;
339
LOAD DATA INFILE 't-1' INTO TABLE t1;
342
SET character_set_filesystem=latin1;
343
select @@character_set_filesystem;
344
LOAD DATA INFILE 't@002d1' INTO TABLE t1;
347
remove_file $MYSQLTEST_VARDIR/master-data/test/t@002d1;
348
SET character_set_filesystem=default;
349
select @@character_set_filesystem;