From a8eb0f176b3db09d238042467789d9dfca1b3b31 Mon Sep 17 00:00:00 2001
From: "tulin@dl145c.mysql.com" <>
Date: Wed, 14 Sep 2005 15:46:31 +0200
Subject: [PATCH] enabled mysqldump hex-blob option for bit fields

---
 client/mysqldump.c               |  3 ++-
 mysql-test/r/ndb_bitfield.result | 16 ++++++++--------
 mysql-test/t/ndb_bitfield.test   |  2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/client/mysqldump.c b/client/mysqldump.c
index be93b48f49..322acbd26c 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2059,7 +2059,8 @@ static void dump_table(uint numFields, char *table)
 	   we'll dump in hex only BLOB columns.
 	*/
         is_blob= (opt_hex_blob && field->charsetnr == 63 &&
-                  (field->type == MYSQL_TYPE_STRING ||
+                  (field->type == MYSQL_TYPE_BIT ||
+                   field->type == MYSQL_TYPE_STRING ||
                    field->type == MYSQL_TYPE_VAR_STRING ||
                    field->type == MYSQL_TYPE_VARCHAR ||
                    field->type == MYSQL_TYPE_BLOB ||
diff --git a/mysql-test/r/ndb_bitfield.result b/mysql-test/r/ndb_bitfield.result
index e2326459a8..bf5a9b1ade 100644
--- a/mysql-test/r/ndb_bitfield.result
+++ b/mysql-test/r/ndb_bitfield.result
@@ -188,14 +188,14 @@ INSERT INTO `t1` VALUES
 (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','?','>',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','\0','=',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','',';',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','0','7',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'','!','/',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,' ','','',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'\0','','?',4,5,5,5,5,5,5,5,5,5,3,2,1);
-INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'?','\0','\0',4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x01,0x3F,0x3E,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (2,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x02,0x00,0x3D,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (3,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x04,0x0F,0x3B,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (4,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x08,0x30,0x37,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (5,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x10,0x21,0x2F,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x20,0x12,0x1F,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x00,0x0C,0x3F,4,5,5,5,5,5,5,5,5,5,3,2,1);
+INSERT INTO `t1` VALUES (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3F,0x00,0x00,4,5,5,5,5,5,5,5,5,5,3,2,1);
 drop table t1;
 create table t1 (
 pk1 bit(9) not null primary key,
diff --git a/mysql-test/t/ndb_bitfield.test b/mysql-test/t/ndb_bitfield.test
index 6b805c2f1c..0256ecf89e 100644
--- a/mysql-test/t/ndb_bitfield.test
+++ b/mysql-test/t/ndb_bitfield.test
@@ -96,7 +96,7 @@ INSERT INTO `t1` VALUES
 (6,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'100000',b'010010',b'011111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 (7,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'000000',b'001100',b'111111',4,5,5,5,5,5,5,5,5,5,3,2,1),
 (8,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,b'111111',b'000000',b'000000',4,5,5,5,5,5,5,5,5,5,3,2,1);
---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test t1
+--exec $MYSQL_DUMP --hex-blob --compact --order-by-primary --skip-extended-insert --no-create-info test t1
 drop table t1;
 
 --error 1005
-- 
2.30.9