List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:November 24 2005 2:31am
Subject:bk commit into 4.1 tree (jimw:1.2479) BUG#13318
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw 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.2479 05/11/23 17:31:44 jimw@stripped +3 -0
  Fix values printed by mysqldump for empty blob fields when
  --hex-blob is used. (Bug #13318)

  mysql-test/t/mysqldump.test
    1.41 05/11/23 17:31:41 jimw@stripped +9 -0
    Add new regression test

  mysql-test/r/mysqldump.result
    1.50 05/11/23 17:31:41 jimw@stripped +63 -0
    Add new results

  client/mysqldump.c
    1.197 05/11/23 17:31:41 jimw@stripped +7 -6
    Don't use 0x... syntax for empty fields.

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-4.1-13318

--- 1.196/client/mysqldump.c	2005-08-25 02:08:20 -07:00
+++ 1.197/client/mysqldump.c	2005-11-23 17:31:41 -08:00
@@ -1768,6 +1768,8 @@
       for (i = 0; i < mysql_num_fields(res); i++)
       {
         int is_blob;
+        ulong length= lengths[i];
+
 	if (!(field = mysql_fetch_field(res)))
 	{
 	  my_snprintf(query, QUERY_LENGTH,
@@ -1777,7 +1779,7 @@
 	  error= EX_CONSCHECK;
 	  goto err;
 	}
-	
+
 	/*
 	   63 is my_charset_bin. If charsetnr is not 63,
 	   we have not a BLOB but a TEXT column. 
@@ -1792,7 +1794,6 @@
                    field->type == FIELD_TYPE_TINY_BLOB)) ? 1 : 0;
 	if (extended_insert)
 	{
-	  ulong length = lengths[i];
 	  if (i == 0)
 	    dynstr_set(&extended_row,"(");
 	  else
@@ -1882,19 +1883,19 @@
 	      {
 	        print_xml_tag1(md_result_file, "\t\t", "field name=",
 			      field->name, "");
-		print_quoted_xml(md_result_file, row[i], lengths[i]);
+		print_quoted_xml(md_result_file, row[i], length);
 		fputs("</field>\n", md_result_file);
 	      }
-	      else if (opt_hex_blob && is_blob)
+	      else if (opt_hex_blob && is_blob && length)
               {
                 /* sakaik got the idea to to provide blob's in hex notation. */
-                char *ptr= row[i], *end= ptr+ lengths[i];
+                char *ptr= row[i], *end= ptr + length;
                 fputs("0x", md_result_file);
                 for (; ptr < end ; ptr++)
 		  fprintf(md_result_file, "%02X", *((uchar *)ptr));
               }
               else
-                unescape(md_result_file, row[i], lengths[i]);
+                unescape(md_result_file, row[i], length);
 	    }
 	    else
 	    {

--- 1.49/mysql-test/r/mysqldump.result	2005-06-22 11:37:12 -07:00
+++ 1.50/mysql-test/r/mysqldump.result	2005-11-23 17:31:41 -08:00
@@ -1493,3 +1493,66 @@
 </database>
 </mysqldump>
 drop table t1, t2;
+create table t1 (a binary(1), b blob);
+insert into t1 values ('','');
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a` binary(1) default NULL,
+  `b` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('','');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a` binary(1) default NULL,
+  `b` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('','');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop table t1;

--- 1.40/mysql-test/t/mysqldump.test	2005-09-29 10:23:12 -07:00
+++ 1.41/mysql-test/t/mysqldump.test	2005-11-23 17:31:41 -08:00
@@ -635,4 +635,13 @@
 --exec $MYSQL_DUMP  --skip-comments --xml --no-create-info test
 drop table t1, t2;
 
+#
+# Bug #13318: Bad result with empty field and --hex-blob
+# 
+create table t1 (a binary(1), b blob);
+insert into t1 values ('','');
+--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
+--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
+drop table t1;
+
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (jimw:1.2479) BUG#13318Jim Winstead24 Nov