Commit be57bb64 authored by unknown's avatar unknown

Merge mysql.com:/home/jimw/my/mysql-4.1-7811

into mysql.com:/home/jimw/my/mysql-5.0-clean


client/mysql.cc:
  Auto merged
parents 568593d6 09d7ad9c
...@@ -155,6 +155,8 @@ static char mysql_charsets_dir[FN_REFLEN+1]; ...@@ -155,6 +155,8 @@ static char mysql_charsets_dir[FN_REFLEN+1];
static const char *xmlmeta[] = { static const char *xmlmeta[] = {
"&", "&", "&", "&",
"<", "&lt;", "<", "&lt;",
">", "&gt;",
"\"", "&quot;",
0, 0 0, 0
}; };
static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"}; static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
...@@ -2126,13 +2128,11 @@ print_table_data_xml(MYSQL_RES *result) ...@@ -2126,13 +2128,11 @@ print_table_data_xml(MYSQL_RES *result)
(void) tee_fputs("\n <row>\n", PAGER); (void) tee_fputs("\n <row>\n", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++) for (uint i=0; i < mysql_num_fields(result); i++)
{ {
tee_fprintf(PAGER, "\t<%s>", (fields[i].name ? tee_fprintf(PAGER, "\t<field name=\"");
(fields[i].name[0] ? fields[i].name : xmlencode_print(fields[i].name, strlen(fields[i].name));
" &nbsp; ") : "NULL")); tee_fprintf(PAGER, "\">");
xmlencode_print(cur[i], lengths[i]); xmlencode_print(cur[i], lengths[i]);
tee_fprintf(PAGER, "</%s>\n", (fields[i].name ? tee_fprintf(PAGER, "</field>\n");
(fields[i].name[0] ? fields[i].name :
" &nbsp; ") : "NULL"));
} }
(void) tee_fputs(" </row>\n", PAGER); (void) tee_fputs(" </row>\n", PAGER);
} }
......
create table t1 (
`a&b` int,
`a<b` int,
`a>b` text
);
insert into t1 values (1, 2, 'a&b a<b a>b');
<?xml version="1.0"?>
<resultset statement="select * from t1
">
<row>
<field name="a&amp;b">1</field>
<field name="a&lt;b">2</field>
<field name="a&gt;b">a&amp;b a&lt;b a&gt;b</field>
</row>
</resultset>
<?xml version="1.0"?>
<mysqldump>
<database name="test">
<table_structure name="t1">
<field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" />
<field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" />
<field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" />
<options Name="t1" Engine="MyISAM" Version="9" Row_format="Dynamic" Rows="1" Avg_row_length="28" Data_length="28" Max_data_length="4294967295" Index_length="1024" Data_free="0" Create_time="2005-01-26 01:21:39" Update_time="2005-01-26 01:21:39" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
<field name="a&amp;b">1</field>
<field name="a&lt;b">2</field>
<field name="a&gt;b">a&amp;b a&lt;b a&gt;b</field>
</row>
</table_data>
</database>
</mysqldump>
<?xml version="1.0"?>
<resultset statement="select count(*) from t1
">
<row>
<field name="count(*)">1</field>
</row>
</resultset>
<?xml version="1.0"?>
<resultset statement="select 1 &lt; 2 from dual
">
<row>
<field name="1 &lt; 2">1</field>
</row>
</resultset>
<?xml version="1.0"?>
<resultset statement="select 1 &gt; 2 from dual
">
<row>
<field name="1 &gt; 2">0</field>
</row>
</resultset>
<?xml version="1.0"?>
<resultset statement="select 1 &amp; 3 from dual
">
<row>
<field name="1 &amp; 3">1</field>
</row>
</resultset>
<?xml version="1.0"?>
<resultset statement="select null from dual
">
<row>
<field name="NULL">NULL</field>
</row>
</resultset>
drop table t1;
# Test of the xml output of the 'mysql' and 'mysqldump' clients -- makes
# sure that basic encoding issues are handled properly
create table t1 (
`a&b` int,
`a<b` int,
`a>b` text
);
insert into t1 values (1, 2, 'a&b a<b a>b');
--exec $MYSQL --xml test -e 'select * from t1'
--exec $MYSQL_DUMP --xml test
--exec $MYSQL --xml test -e 'select count(*) from t1'
--exec $MYSQL --xml test -e 'select 1 < 2 from dual'
--exec $MYSQL --xml test -e 'select 1 > 2 from dual'
--exec $MYSQL --xml test -e 'select 1 & 3 from dual'
--exec $MYSQL --xml test -e 'select null from dual'
drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment