From 8b0f82b9b8ae8a892e67a55dd3dc10154a4cef00 Mon Sep 17 00:00:00 2001
From: "bar@mysql.com/bar.intranet.mysql.r18.ru" <>
Date: Fri, 29 Sep 2006 16:29:39 +0500
Subject: [PATCH] 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:
to distinguish from empty strings:
and from string "NULL":
NULL
---
client/mysql.cc | 11 ++++++++---
mysql-test/r/client_xml.result | 2 +-
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");
- xmlencode_print(cur[i], lengths[i]);
- tee_fprintf(PAGER, "\n");
+ if (cur[i])
+ {
+ tee_fprintf(PAGER, "\">");
+ xmlencode_print(cur[i], lengths[i]);
+ tee_fprintf(PAGER, "\n");
+ }
+ else
+ tee_fprintf(PAGER, "\" xsi:nil=\"true\" />\n");
}
(void) tee_fputs(" \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 ab');
- NULL
+
drop table t1;