summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorjimw@mysql.com <>2005-01-25 14:25:40 -0800
committerjimw@mysql.com <>2005-01-25 14:25:40 -0800
commitec98b8f23572c1843487f8e21f5027531ba14ee1 (patch)
treeba33c06d61ac622412dbe5d3d8e205bf91462352 /client
parent7454f2f09769665afd59c53b49e1bf62454f0672 (diff)
downloadmariadb-git-ec98b8f23572c1843487f8e21f5027531ba14ee1.tar.gz
Change 'mysql' client to output XML like the 'mysqldump'
tool does, with the column names as attributes on <field> elements, instead of trying to use the column name as the element name. Also fix some encoding issues. (Bug #7811)
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 635973e946c..1223a952264 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -154,6 +154,8 @@ static char mysql_charsets_dir[FN_REFLEN+1];
static const char *xmlmeta[] = {
"&", "&amp;",
"<", "&lt;",
+ ">", "&gt;",
+ "\"", "&quot;",
0, 0
};
static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
@@ -2116,13 +2118,11 @@ print_table_data_xml(MYSQL_RES *result)
(void) tee_fputs("\n <row>\n", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++)
{
- tee_fprintf(PAGER, "\t<%s>", (fields[i].name ?
- (fields[i].name[0] ? fields[i].name :
- " &nbsp; ") : "NULL"));
+ tee_fprintf(PAGER, "\t<field name=\"");
+ xmlencode_print(fields[i].name, strlen(fields[i].name));
+ tee_fprintf(PAGER, "\">");
xmlencode_print(cur[i], lengths[i]);
- tee_fprintf(PAGER, "</%s>\n", (fields[i].name ?
- (fields[i].name[0] ? fields[i].name :
- " &nbsp; ") : "NULL"));
+ tee_fprintf(PAGER, "</field>\n");
}
(void) tee_fputs(" </row>\n", PAGER);
}