2
# Tests for "LOAD XML" - a contributed patch from Erik Wetterberg.
5
# Running the $MYSQL_DUMP tool against an embedded server does not work.
6
--source include/not_embedded.inc
9
drop table if exists t1, t2;
12
create table t1 (a int, b varchar(64));
15
--echo -- Load a static XML file
16
load xml infile '../../std_data/loadxml.dat' into table t1
17
rows identified by '<row>';
18
select * from t1 order by a;
22
--echo -- Load a static XML file with 'IGNORE num ROWS'
23
load xml infile '../../std_data/loadxml.dat' into table t1
24
rows identified by '<row>' ignore 4 rows;
25
select * from t1 order by a;
28
--echo -- Check 'mysqldump --xml' + 'LOAD XML' round trip
29
--exec $MYSQL_DUMP --xml test t1 > "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" 2>&1
31
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
32
--eval load xml infile '$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1 rows identified by '<row>';
33
select * from t1 order by a;
35
--echo --Check that default row tag is '<row>
37
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
38
--eval load xml infile '$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml' into table t1;
39
select * from t1 order by a;
41
--echo -- Check that 'xml' is not a keyword
46
# Bug #42520 killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
51
insert into t1 values (1, '12345678900987654321'), (2, 'asdfghjkl;asdfghjkl;');
52
insert into t1 select * from t1;
53
insert into t1 select * from t1;
54
insert into t1 select * from t1;
55
insert into t1 select * from t1;
56
insert into t1 select * from t1;
57
insert into t1 select * from t1;
58
insert into t1 select * from t1;
59
insert into t1 select * from t1;
60
insert into t1 select * from t1;
61
insert into t1 select * from t1;
62
insert into t1 select * from t1;
63
insert into t1 select * from t1;
64
insert into t1 select * from t1;
65
--exec $MYSQL_DUMP --xml test t1 > "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" 2>&1
68
connect (addconroot, localhost, root,,);
69
connection addconroot;
70
create table t2(fl text);
71
--let $PSEUDO_THREAD_ID=`select @@pseudo_thread_id `
73
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
74
--send_eval LOAD XML LOCAL INFILE "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" INTO TABLE t2 ROWS IDENTIFIED BY '<person>';
82
--eval kill $PSEUDO_THREAD_ID
83
connection addconroot;
84
# Read response from connection to avoid packets out-of-order when disconnecting
85
# Note, that connection can already be dead due to previously issued kill
88
disconnect addconroot;
94
remove_file $MYSQLTEST_VARDIR/tmp/loadxml-dump.xml;
99
# Bug #36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
106
) engine=MyISAM default charset=latin1;
107
load xml infile '../../std_data/loadxml2.dat' into table t1;
112
--echo # Bug#51571 load xml infile causes server crash
114
CREATE TABLE t1 (a text, b text);
115
LOAD XML INFILE '../../std_data/loadxml.dat' INTO TABLE t1
116
ROWS IDENTIFIED BY '<row>' (a,@b) SET b=concat('!',@b);
117
SELECT * FROM t1 ORDER BY a;