2003-05-05 13:52:39 +02:00
|
|
|
#
|
|
|
|
# Some simple test of load data
|
|
|
|
#
|
|
|
|
|
2003-05-21 20:39:58 +02:00
|
|
|
--disable_warnings
|
2003-05-05 13:52:39 +02:00
|
|
|
drop table if exists t1;
|
2003-05-21 20:39:58 +02:00
|
|
|
--enable_warnings
|
2003-05-05 13:52:39 +02:00
|
|
|
|
|
|
|
create table t1 (a date, b date, c date not null, d date);
|
|
|
|
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
|
|
|
|
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
|
|
|
|
SELECT * from t1;
|
2003-05-26 10:47:03 +02:00
|
|
|
truncate table t1;
|
|
|
|
|
|
|
|
load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
|
|
|
|
SELECT * from t1;
|
2003-05-05 13:52:39 +02:00
|
|
|
drop table t1;
|
2003-05-26 10:47:03 +02:00
|
|
|
|
2003-08-22 03:07:40 +02:00
|
|
|
create table t1 (a text, b text);
|
|
|
|
load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
|
|
|
|
select concat('|',a,'|'), concat('|',b,'|') from t1;
|
|
|
|
drop table t1;
|
2003-12-14 05:39:52 +01:00
|
|
|
|
|
|
|
create table t1 (a int, b char(10));
|
|
|
|
load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
|
|
|
|
select * from t1;
|
|
|
|
truncate table t1;
|
|
|
|
load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
|
|
|
|
|
|
|
|
# The empty line last comes from the end line field in the file
|
|
|
|
select * from t1;
|
|
|
|
drop table t1;
|
|
|
|
|