#At file:///home/hf/work/mysql_common/36750/ based on revid:jon.hauglid@stripped
2836 Alexey Botchkov 2009-07-30
Bug#36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
Reading values of the XML tags, we turn linefeeds and tabs into spaces with the
my_tospace() call.
per-file comments:
mysql-test/r/loadxml.result
Bug#36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
test result completed
mysql-test/t/loadxml.test
Bug#36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
test result added
sql/sql_load.cc
Bug#36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
add original characters to the 'value', not distorted with the my_tospace()
added:
mysql-test/std_data/loadxml2.dat
modified:
mysql-test/r/loadxml.result
mysql-test/t/loadxml.test
sql/sql_load.cc
=== modified file 'mysql-test/r/loadxml.result'
--- a/mysql-test/r/loadxml.result 2008-04-08 08:06:05 +0000
+++ b/mysql-test/r/loadxml.result 2009-07-30 11:32:37 +0000
@@ -58,3 +58,15 @@ select 1 as xml;
xml
1
drop table t1;
+create table t1 (
+id int(11) not null,
+text text,
+primary key (id)
+) engine=MyISAM default charset=latin1;
+load xml infile '../../std_data/loadxml2.dat' into table t1;
+select * from t1;
+id text
+1 line1
+line2
+line3
+drop table t1;
=== added file 'mysql-test/std_data/loadxml2.dat'
--- a/mysql-test/std_data/loadxml2.dat 1970-01-01 00:00:00 +0000
+++ b/mysql-test/std_data/loadxml2.dat 2009-07-30 11:32:37 +0000
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="test_of_xml_import">
+ <table_structure name="t1">
+ <field Field="id" Type="int(11)" Null="NO" Key="PRI" Extra="" />
+ <field Field="text" Type="text" Null="YES" Key="" Extra="" />
+ <key Table="t1" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="1" Null="" Index_type="BTREE" Comment="" Index_Comment="" />
+ <options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="1" Avg_row_length="32" Data_length="32" Max_data_length="281474976710655" Index_length="2048" Data_free="0" Create_time="2009-06-18 10:02:37" Update_time="2009-06-18 10:02:43" Collation="latin1_swedish_ci" Create_options="" Comment="" />
+ </table_structure>
+ <table_data name="t1">
+ <row>
+ <field name="id">1</field>
+ <field name="text">line1
+line2
+line3</field>
+ </row>
+ </table_data>
+</database>
+</mysqldump>
=== modified file 'mysql-test/t/loadxml.test'
--- a/mysql-test/t/loadxml.test 2008-10-29 08:45:14 +0000
+++ b/mysql-test/t/loadxml.test 2009-07-30 11:32:37 +0000
@@ -48,3 +48,16 @@ select 1 as xml;
remove_file $MYSQLTEST_VARDIR/tmp/loadxml-dump.xml;
drop table t1;
+#
+# Bug #36750 LOAD XML doesn't understand new line (feed) characters in multi line text fields
+#
+
+create table t1 (
+ id int(11) not null,
+ text text,
+ primary key (id)
+) engine=MyISAM default charset=latin1;
+load xml infile '../../std_data/loadxml2.dat' into table t1;
+select * from t1;
+drop table t1;
+
=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc 2009-07-24 14:04:20 +0000
+++ b/sql/sql_load.cc 2009-07-30 11:32:37 +0000
@@ -1632,7 +1632,7 @@ int READ_INFO::read_value(int delim, Str
int chr;
String tmp;
- for (chr= my_tospace(GET); chr != delim && chr != my_b_EOF; )
+ for (chr= GET; my_tospace(chr) != delim && chr != my_b_EOF;)
{
#ifdef USE_MB
if (my_mbcharlen(read_charset, chr) > 1)
@@ -1672,9 +1672,9 @@ int READ_INFO::read_value(int delim, Str
}
else
val->append(chr);
- chr= my_tospace(GET);
+ chr= GET;
}
- return chr;
+ return my_tospace(chr);
}
Attachment: [text/bzr-bundle] bzr/holyfoot@mysql.com-20090730113237-wgo7i4i99jsvm7z9.bundle
Thread |
---|
• bzr commit into mysql-5.4 branch (holyfoot:2836) Bug#36750 | Alexey Botchkov | 30 Jul |