From 33ac50f0769a01028bdb57a741eb449140ca5504 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Apr 2007 17:53:10 +0500 Subject: bug#27608 XML output is not well-formed Problem: output was empty if the result is empty. Fix: print XML header and footer, even if the result is empty, to produce well-formed XML output. client/mysql.cc: Print header and footer even on empty set, when --xml mysql-test/r/client_xml.result: Adding test case mysql-test/t/client_xml.test: Adding test case --- client/mysql.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'client/mysql.cc') diff --git a/client/mysql.cc b/client/mysql.cc index 510420fdf3d..6b37bb7b6f5 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2117,6 +2117,17 @@ com_go(String *buffer,char *line __attribute__((unused))) if (!mysql_num_rows(result) && ! quick && !info_flag) { strmov(buff, "Empty set"); + if (opt_xml) + { + /* + We must print XML header and footer + to produce a well-formed XML even if + the result set is empty (Bug#27608). + */ + init_pager(); + print_table_data_xml(result); + end_pager(); + } } else { -- cgit v1.2.1