summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorbar@mysql.com/bar.intranet.mysql.r18.ru <>2006-09-29 16:29:39 +0500
committerbar@mysql.com/bar.intranet.mysql.r18.ru <>2006-09-29 16:29:39 +0500
commit8b0f82b9b8ae8a892e67a55dd3dc10154a4cef00 (patch)
tree7cfa1d566858e9efd7cca5523f1520a4a7e339f6 /client
parent53dea28352e25fe9b4f8b79c357b399ffe95406c (diff)
downloadmariadb-git-8b0f82b9b8ae8a892e67a55dd3dc10154a4cef00.tar.gz
Bug#21263 mysql client XML output does not distinguish between NULL and string 'NULL'
Fix: "mysql --xml" now print NULL values the same way that "mysqldump --xml" does: <field name="name" xsi:nil="true" /> to distinguish from empty strings: <field name="name"></field> and from string "NULL": <field name="name">NULL</field>
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 5e09c309917..f1a140a6c5a 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -2509,9 +2509,14 @@ print_table_data_xml(MYSQL_RES *result)
{
tee_fprintf(PAGER, "\t<field name=\"");
xmlencode_print(fields[i].name, (uint) strlen(fields[i].name));
- tee_fprintf(PAGER, "\">");
- xmlencode_print(cur[i], lengths[i]);
- tee_fprintf(PAGER, "</field>\n");
+ if (cur[i])
+ {
+ tee_fprintf(PAGER, "\">");
+ xmlencode_print(cur[i], lengths[i]);
+ tee_fprintf(PAGER, "</field>\n");
+ }
+ else
+ tee_fprintf(PAGER, "\" xsi:nil=\"true\" />\n");
}
(void) tee_fputs(" </row>\n", PAGER);
}