summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-09-29 16:29:39 +0500
committerunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-09-29 16:29:39 +0500
commit1b4d6a055a6407f1e446b8333c9d31e5c2868886 (patch)
tree7cfa1d566858e9efd7cca5523f1520a4a7e339f6
parent880c9b2a8b5c5239701b60bdb5f6cc8559be3470 (diff)
downloadmariadb-git-1b4d6a055a6407f1e446b8333c9d31e5c2868886.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> client/mysql.cc: Fixing to print NULLs differently from empty strings mysql-test/r/client_xml.result: Fixing test result accordingly
-rw-r--r--client/mysql.cc11
-rw-r--r--mysql-test/r/client_xml.result2
2 files changed, 9 insertions, 4 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);
}
diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result
index 24c05c7f9d6..7395b2433e8 100644
--- a/mysql-test/r/client_xml.result
+++ b/mysql-test/r/client_xml.result
@@ -68,7 +68,7 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
<resultset statement="select null from dual
">
<row>
- <field name="NULL">NULL</field>
+ <field name="NULL" xsi:nil="true" />
</row>
</resultset>
drop table t1;