List:Internals« Previous MessageNext Message »
From:msvensson Date:June 14 2005 11:27am
Subject:bk commit into 4.1 tree (msvensson:1.2290) 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.2290 05/06/14 11:27:49 msvensson@neptunus.(none) +3 -0
  Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly

  mysql-test/t/mysqldump.test
    1.34 05/06/14 11:27:46 msvensson@neptunus.(none) +13 -0
    Add tests for NULL fields in XML data

  mysql-test/r/mysqldump.result
    1.46 05/06/14 11:27:46 msvensson@neptunus.(none) +56 -0
    Add test results for NULL fields in XML data

  client/mysqldump.c
    1.189 05/06/14 11:27:46 msvensson@neptunus.(none) +12 -1
    Add code to XML format NULL values correctly.

# 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.188/client/mysqldump.c	2005-05-20 15:56:00 +02:00
+++ 1.189/client/mysqldump.c	2005-06-14 11:27:46 +02:00
@@ -1867,7 +1867,18 @@
 	    }
 	  }
 	  else
-            fputs("NULL", md_result_file);
+          {
+            /* The field value is NULL */
+            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);
+            }
+          }
           check_io(md_result_file);
 	}
       }

--- 1.45/mysql-test/r/mysqldump.result	2005-05-20 15:56:00 +02:00
+++ 1.46/mysql-test/r/mysqldump.result	2005-06-14 11:27:46 +02:00
@@ -1349,3 +1349,59 @@
 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
 
 DROP TABLE t1;
+create table t1 (a int(10));
+create table t2 (pk int primary key auto_increment,
+a int(10), b varchar(30), c datetime, d blob, e text);
+insert into t1 values (NULL), (10), (20);
+insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty");
+<?xml version="1.0"?>
+<mysqldump>
+<database name="test">
+	<table_data name="t1">
+	<row>
+		<field name="a">NULL</field>
+	</row>
+	<row>
+		<field name="a">10</field>
+	</row>
+	<row>
+		<field name="a">20</field>
+	</row>
+	</table_data>
+	<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>
+	</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>
+	</row>
+	<row>
+		<field name="pk">3</field>
+		<field name="a">NULL</field>
+		<field name="b">twenty</field>
+		<field name="c">NULL</field>
+		<field name="d">NULL</field>
+		<field name="e">NULL</field>
+	</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>
+	</row>
+	</table_data>
+</database>
+</mysqldump>
+drop table t1, t2;

--- 1.33/mysql-test/t/mysqldump.test	2005-05-20 15:56:00 +02:00
+++ 1.34/mysql-test/t/mysqldump.test	2005-06-14 11:27:46 +02:00
@@ -543,3 +543,16 @@
 INSERT INTO t1 VALUES (1),(2),(3);
 --exec $MYSQL_DUMP --add-drop-database --skip-comments --databases test
 DROP TABLE t1;
+
+#
+# Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
+#
+
+create table t1 (a int(10));
+create table t2 (pk int primary key auto_increment,
+a int(10), b varchar(30), c datetime, d blob, e text);
+insert into t1 values (NULL), (10), (20);
+insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty");
+--exec $MYSQL_DUMP  --skip-comments --xml --no-create-info test
+drop table t1, t2;
+
Thread
bk commit into 4.1 tree (msvensson:1.2290) BUG#9657msvensson14 Jun