Debian Codegraph @

mysql-test/suite/ndb/t/ndb_loaddatalocal.test

raw
1 -- source include/have_ndb.inc
2
3 --disable_warnings
4 DROP TABLE IF EXISTS t1;
5 --enable_warnings
6
7 create table t1(a int) engine=myisam;
8 let $1=10000;
9 disable_query_log;
10 set SQL_LOG_BIN=0;
11 while ($1)
12 {
13 insert into t1 values(1);
14 dec $1;
15 }
16 set SQL_LOG_BIN=1;
17 let $MYSQLD_DATADIR= `select @@datadir`;
18 enable_query_log;
19 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
20 eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
21 #This will generate a 20KB file, now test LOAD DATA LOCAL
22 drop table t1;
23
24 create table t1(a int) engine=ndb;
25 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
26 eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
27 select count(*) from t1;
28 --remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
29 drop table t1;
30
31 create table t1(a int) engine=myisam;
32 insert into t1 values (1), (2), (2), (3);
33 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
34 eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
35 drop table t1;
36
37 create table t1(a int primary key) engine=ndb;
38 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
39 eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
40 --remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
41 select * from t1 order by a;
42 drop table t1;
43
44 create table t1(a int) engine=myisam;
45 insert into t1 values (1), (1), (2), (3);
46 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
47 eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
48 drop table t1;
49
50 create table t1(a int primary key) engine=ndb;
51 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
52 eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
53 --remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
54 select * from t1 order by a;
55 drop table t1;
56
57 create table t1(a int) engine=myisam;
58 insert into t1 values (1), (2), (3), (3);
59 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
60 eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
61 drop table t1;
62
63 create table t1(a int primary key) engine=ndb;
64 --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
65 eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
66 --remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
67 select * from t1 order by a;
68 drop table t1;
69
70 # End of 4.1 tests