List:Internals« Previous MessageNext Message »
From:msvensson Date:June 20 2005 12:46pm
Subject:bk commit into 4.1 tree (msvensson:1.2291) BUG#9657
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2291 05/06/20 12:46:55 msvensson@neptunus.(none) +2 -0
  BUG#9657 mysqldump xml ( -x ) does not format NULL fields correctly
   - Added function for printing null fields

  mysql-test/r/mysqldump.result
    1.47 05/06/20 12:46:52 msvensson@neptunus.(none) +17 -17
    Updated results

  client/mysqldump.c
    1.190 05/06/20 12:46:52 msvensson@neptunus.(none) +36 -6
    Add function for printing null fields. Implemented printout as xsi:nil=true 

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug9657

--- 1.189/client/mysqldump.c	2005-06-14 11:27:46 +02:00
+++ 1.190/client/mysqldump.c	2005-06-20 12:46:52 +02:00
@@ -1049,6 +1049,40 @@
 
 
 /*
+  Print xml tag with for a field that is null
+
+  SYNOPSIS
+    print_xml_null_tag()
+    xml_file	- output file
+    sbeg	- line beginning
+    stag_atr	- tag and attribute
+    sval	- value of attribute
+    send	- line ending
+
+  DESCRIPTION
+    Print tag with one attribute to the xml_file. Format is:
+      <stag_atr="sval" nil="true"/>
+  NOTE
+    sval MUST be a NULL terminated string.
+    sval string will be qouted before output.
+*/
+
+static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
+                               const char* stag_atr, const char* sval,
+                               const char* send)
+{
+  fputs(sbeg, xml_file);
+  fputs("<", xml_file);
+  fputs(stag_atr, xml_file);
+  fputs("\"", xml_file);
+  print_quoted_xml(xml_file, sval, strlen(sval));
+  fputs("\" nil=\"true\" />", xml_file);
+  fputs(send, xml_file);
+  check_io(xml_file);
+}
+
+
+/*
   Print xml tag with many attributes.
 
   SYNOPSIS
@@ -1872,12 +1906,8 @@
             if (!opt_xml)
               fputs("NULL", md_result_file);
             else
-            {
-              print_xml_tag1(md_result_file, "\t\t", "field name=",
-                             field->name, "");
-              print_quoted_xml(md_result_file, "NULL", 4);
-              fputs("</field>\n", md_result_file);
-            }
+              print_xml_null_tag(md_result_file, "\t\t", "field name=",
+                                 field->name, "\n");
           }
           check_io(md_result_file);
 	}

--- 1.46/mysql-test/r/mysqldump.result	2005-06-14 11:27:46 +02:00
+++ 1.47/mysql-test/r/mysqldump.result	2005-06-20 12:46:52 +02:00
@@ -1359,7 +1359,7 @@
 <database name="test">
 	<table_data name="t1">
 	<row>
-		<field name="a">NULL</field>
+		<field name="a" nil="true" />
 	</row>
 	<row>
 		<field name="a">10</field>
@@ -1371,35 +1371,35 @@
 	<table_data name="t2">
 	<row>
 		<field name="pk">1</field>
-		<field name="a">NULL</field>
-		<field name="b">NULL</field>
-		<field name="c">NULL</field>
-		<field name="d">NULL</field>
-		<field name="e">NULL</field>
+		<field name="a" nil="true" />
+		<field name="b" nil="true" />
+		<field name="c" nil="true" />
+		<field name="d" nil="true" />
+		<field name="e" nil="true" />
 	</row>
 	<row>
 		<field name="pk">2</field>
 		<field name="a">10</field>
-		<field name="b">NULL</field>
-		<field name="c">NULL</field>
-		<field name="d">NULL</field>
-		<field name="e">NULL</field>
+		<field name="b" nil="true" />
+		<field name="c" nil="true" />
+		<field name="d" nil="true" />
+		<field name="e" nil="true" />
 	</row>
 	<row>
 		<field name="pk">3</field>
-		<field name="a">NULL</field>
+		<field name="a" nil="true" />
 		<field name="b">twenty</field>
-		<field name="c">NULL</field>
-		<field name="d">NULL</field>
-		<field name="e">NULL</field>
+		<field name="c" nil="true" />
+		<field name="d" nil="true" />
+		<field name="e" nil="true" />
 	</row>
 	<row>
 		<field name="pk">4</field>
 		<field name="a">30</field>
 		<field name="b">thirty</field>
-		<field name="c">NULL</field>
-		<field name="d">NULL</field>
-		<field name="e">NULL</field>
+		<field name="c" nil="true" />
+		<field name="d" nil="true" />
+		<field name="e" nil="true" />
 	</row>
 	</table_data>
 </database>
Thread
bk commit into 4.1 tree (msvensson:1.2291) BUG#9657msvensson20 Jun