~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to mysql-test/t/loadxml.test

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Tests for "LOAD XML" - a contributed patch from Erik Wetterberg.
 
3
#
 
4
 
 
5
# Running the $MYSQL_DUMP tool against an embedded server does not work.
 
6
--source include/not_embedded.inc
 
7
 
 
8
--disable_warnings
 
9
drop table if exists t1, t2;
 
10
--enable_warnings
 
11
 
 
12
create table t1 (a int, b varchar(64));
 
13
 
 
14
 
 
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;
 
19
delete from t1;
 
20
 
 
21
 
 
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;
 
26
 
 
27
 
 
28
--echo -- Check 'mysqldump --xml' + 'LOAD XML' round trip
 
29
--exec $MYSQL_DUMP --xml test t1 > "$MYSQLTEST_VARDIR/tmp/loadxml-dump.xml" 2>&1
 
30
delete from t1;
 
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;
 
34
 
 
35
--echo --Check that default row tag is '<row>
 
36
delete from t1;
 
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;
 
40
 
 
41
--echo -- Check that 'xml' is not a keyword
 
42
select 1 as xml;
 
43
 
 
44
 
 
45
#
 
46
# Bug #42520    killing load .. infile Assertion failed: ! is_set(), file .\sql_error.cc, line 8
 
47
#
 
48
 
 
49
--disable_query_log
 
50
delete from t1;
 
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
 
66
--enable_query_log
 
67
 
 
68
connect (addconroot, localhost, root,,);
 
69
connection addconroot;
 
70
create table t2(fl text);
 
71
--let $PSEUDO_THREAD_ID=`select @@pseudo_thread_id    `
 
72
 
 
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>';
 
75
 
 
76
sleep 3;
 
77
 
 
78
 
 
79
connection default;
 
80
 
 
81
--disable_query_log
 
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
 
86
--error 0,2013
 
87
--reap
 
88
disconnect addconroot;
 
89
connection default;
 
90
--enable_query_log
 
91
#
 
92
# Clean up
 
93
#
 
94
remove_file $MYSQLTEST_VARDIR/tmp/loadxml-dump.xml;
 
95
drop table t1;
 
96
drop table t2;
 
97
 
 
98
#
 
99
# Bug #36750    LOAD XML doesn't understand new line (feed) characters in multi line text fields
 
100
#
 
101
 
 
102
create table t1 (
 
103
  id int(11) not null,
 
104
  text text,
 
105
  primary key (id)
 
106
) engine=MyISAM default charset=latin1;
 
107
load xml infile '../../std_data/loadxml2.dat' into table t1;
 
108
select * from t1;
 
109
drop table t1;
 
110
 
 
111
--echo #
 
112
--echo # Bug#51571 load xml infile causes server crash
 
113
--echo #
 
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;
 
118
DROP TABLE t1;