1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
#
# Basic LOAD DATA statements
#
--source have_engine.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
--source create_table.inc
let $datadir = `SELECT @@datadir`;
--write_file $datadir/se_loaddata.dat
1,foo,
2,bar,
3,,
4,abc,
EOF
--replace_result $datadir <DATADIR>
eval
LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
FIELDS TERMINATED BY ',' (a,b);
if ($mysql_errname)
{
--source unexpected_result.inc
--remove_file $datadir/se_loaddata.dat
}
if (!$mysql_errname)
{
--sorted_result
SELECT a,b FROM t1;
--replace_result $datadir <DATADIR>
eval
LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
CHARACTER SET utf8 COLUMNS TERMINATED BY ','
ESCAPED BY '/' (a,b);
--sorted_result
SELECT a,b FROM t1;
--remove_file $datadir/se_loaddata.dat
--write_file $datadir/se_loaddata.dat
5;YYY;
102;'zzz';
0;'test';
EOF
--replace_result $datadir <DATADIR>
eval
LOAD DATA LOCAL INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
FIELDS TERMINATED BY ';'
(a) SET b='loaded';
--sorted_result
SELECT a,b FROM t1;
--remove_file $datadir/se_loaddata.dat
--write_file $datadir/se_loaddata.dat
prefix:5;'foo';
prefix:6;'';
prefix:100;foo;
prefix:7;'test';suffix
101;abc;
102;'z';
prefix:0;;
EOF
--replace_result $datadir <DATADIR>
eval
LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1
FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY ''''
LINES STARTING BY 'prefix:'
IGNORE 2 LINES (a,b);
--sorted_result
SELECT a,b FROM t1;
--remove_file $datadir/se_loaddata.dat
--write_file $datadir/se_loaddata.dat
1 foo
2 bar
3
4 abc
EOF
--replace_result $datadir <DATADIR>
eval
LOAD DATA INFILE '$datadir/se_loaddata.dat' INTO TABLE t1;
--sorted_result
SELECT a,b FROM t1;
--remove_file $datadir/se_loaddata.dat
}
# Cleanup
DROP TABLE t1;
--source cleanup_engine.inc
|