List:Commits« Previous MessageNext Message »
From:tomas Date:March 1 2007 5:40am
Subject:bk commit into 5.1 tree (tomas:1.2442)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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.2442 07/03/01 12:40:26 tomas@stripped +4 -0
  ndb_restore patch tmp commit

  mysql-test/t/ndb_restore_print.test
    1.1 07/03/01 12:40:17 tomas@stripped +97 -0
    New BitKeeper file ``mysql-test/t/ndb_restore_print.test''

  mysql-test/r/ndb_restore_print.result
    1.1 07/03/01 12:40:17 tomas@stripped +87 -0
    New BitKeeper file ``mysql-test/r/ndb_restore_print.result''

  mysql-test/t/ndb_restore_print.test
    1.0 07/03/01 12:40:17 tomas@stripped +0 -0
    BitKeeper file /home/tomas/mysql-5.1-telco-6.1.4/mysql-test/t/ndb_restore_print.test

  mysql-test/r/ndb_restore_print.result
    1.0 07/03/01 12:40:17 tomas@stripped +0 -0
    BitKeeper file /home/tomas/mysql-5.1-telco-6.1.4/mysql-test/r/ndb_restore_print.result

  mysql-test/include/ndb_backup_print.inc
    1.1 07/03/01 12:40:16 tomas@stripped +3 -0
    New BitKeeper file ``mysql-test/include/ndb_backup_print.inc''

  storage/ndb/src/ndbapi/NdbRecAttr.cpp
    1.34 07/03/01 12:40:16 tomas@stripped +34 -14
    ndb_restore patch tmp commit

  mysql-test/include/ndb_backup_print.inc
    1.0 07/03/01 12:40:16 tomas@stripped +0 -0
    BitKeeper file /home/tomas/mysql-5.1-telco-6.1.4/mysql-test/include/ndb_backup_print.inc

# 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:	tomas
# Host:	poseidon.mysql.com
# Root:	/home/tomas/mysql-5.1-telco-6.1.4

--- 1.33/storage/ndb/src/ndbapi/NdbRecAttr.cpp	2007-03-01 09:46:14 +07:00
+++ 1.34/storage/ndb/src/ndbapi/NdbRecAttr.cpp	2007-03-01 12:40:16 +07:00
@@ -160,19 +160,33 @@ ndbrecattr_print_string(NdbOut& out, con
 {
   const unsigned char* ref = (const unsigned char*)aref;
   int i, len, printable= 1;
-  // trailing zeroes are not printed
-  for (i=sz-1; i >= 0; i--)
-    if (ref[i] == 0) sz--;
-    else break;
-  if (sz == 0) return; // empty
-
+  if (is_binary)
+  {
+    // trailing zeroes are not printed
+    for (i=sz-1; i >= 0; i--)
+      if (ref[i] == 0) sz--;
+      else break;
+  }
+  else
+  {
+    // trailing spaces are not printed
+    for (i=sz-1; i >= 0; i--)
+      if (ref[i] == 32) sz--;
+      else break;
+  }
   if (is_binary && f.hex_format)
   {
+    if (sz == 0)
+    {
+      out.print("0x0");
+      return;
+    }
     out.print("0x");
-    for (len=0; len < (int)sz; len++)
+    for (len = 0; len < (int)sz; len++)
       out.print("%02X", (int)ref[len]);
     return;
   }
+  if (sz == 0) return; // empty
 
   for (len=0; len < (int)sz && ref[i] != 0; len++)
     if (printable && !isprint((int)ref[i]))
@@ -227,7 +241,7 @@ ndbrecattr_print_formatted(NdbOut& out, 
           break;
       if (j == 0)
       {
-        out << "0";
+        out << "0x0";
         break;
       }
       out << f.hex_prefix << "0x";
@@ -262,10 +276,12 @@ ndbrecattr_print_formatted(NdbOut& out, 
       out << (int) r.char_value();
       break;
     case NdbDictionary::Column::Binary:
-      out << fields_optionally_enclosed_by;
+      if (!f.hex_format)
+        out << fields_optionally_enclosed_by;
       j = r.get_size_in_bytes();
       ndbrecattr_print_string(out,f,"Binary", true, r.aRef(), j);
-      out << fields_optionally_enclosed_by;
+      if (!f.hex_format)
+        out << fields_optionally_enclosed_by;
       break;
     case NdbDictionary::Column::Char:
       out << fields_optionally_enclosed_by;
@@ -284,11 +300,13 @@ ndbrecattr_print_formatted(NdbOut& out, 
     break;
     case NdbDictionary::Column::Varbinary:
     {
-      out << fields_optionally_enclosed_by;
+      if (!f.hex_format)
+        out << fields_optionally_enclosed_by;
       unsigned len = *(const unsigned char*)r.aRef();
       ndbrecattr_print_string(out,f,"Varbinary", true, r.aRef()+1,len);
       j = length;
-      out << fields_optionally_enclosed_by;
+      if (!f.hex_format)
+        out << fields_optionally_enclosed_by;
     }
     break;
     case NdbDictionary::Column::Float:
@@ -426,11 +444,13 @@ ndbrecattr_print_formatted(NdbOut& out, 
     break;
     case NdbDictionary::Column::Longvarbinary:
     {
-      out << fields_optionally_enclosed_by;
+      if (!f.hex_format)
+        out << fields_optionally_enclosed_by;
       unsigned len = uint2korr(r.aRef());
       ndbrecattr_print_string(out,f,"Longvarbinary", true, r.aRef()+2,len);
       j = length;
-      out << fields_optionally_enclosed_by;
+      if (!f.hex_format)
+        out << fields_optionally_enclosed_by;
     }
     break;
 
--- New file ---
+++ mysql-test/include/ndb_backup_print.inc	07/03/01 12:40:16
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --verbose=0 $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id > $MYSQLTEST_VARDIR/tmp.dat
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --verbose=0 $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $MYSQLTEST_VARDIR/tmp.dat
--exec sort $MYSQLTEST_VARDIR/tmp.dat

--- New file ---
+++ mysql-test/r/ndb_restore_print.result	07/03/01 12:40:17
use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
create table t1
(pk int key
,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
,b1 TINYINT, b2 TINYINT UNSIGNED
,c1 SMALLINT, c2 SMALLINT UNSIGNED
,d1 INT, d2 INT UNSIGNED
,e1 BIGINT, e2 BIGINT UNSIGNED
,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
) engine ndb;
insert into t1 values
(1
,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
,127, 255
,32767, 65535
,2147483647, 4294967295
,9223372036854775807, 18446744073709551615
,'1','12345678901234567890123456789012','123456789'
  ,'1','12345678901234567890123456789012','123456789'
  ,0x12,0x123456789abcdef0, 0x012345
,0x12,0x123456789abcdef0, 0x00123450
);
insert into t1 values
(2
,0, 0, 0, 0, 0
,-128, 0
,-32768, 0
,-2147483648, 0
,-9223372036854775808, 0
,'','',''
  ,'','',''
  ,0x0,0x0,0x0
,0x0,0x0,0x0
);
insert into t1 values
(3
,NULL,NULL,NULL,NULL,NULL
,NULL,NULL
,NULL,NULL
,NULL,NULL
,NULL,NULL
,NULL,NULL,NULL
,NULL,NULL,NULL
,NULL,NULL,NULL
,NULL,NULL,NULL
);
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450
2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0
3;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N
1,0x1,0x17,0x789A,0x789ABCDE,0xFEDC0001,127,255,32767,65535,2147483647,4294967295,9223372036854775807,18446744073709551615,'1','12345678901234567890123456789012','123456789','1','12345678901234567890123456789012','123456789',0x12,0x123456789ABCDEF0,0x012345,0x12,0x123456789ABCDEF0,0x00123450
2,0x0,0x0,0x0,0x0,0x0,-128,0,-32768,0,-2147483648,0,-9223372036854775808,0,'','','','','','',0x0,0x0,0x0,0x0,0x0,0x0
3,,,,,,,,,,,,,,,,,,,,,,,,,
drop table t1;
create table t1
(pk int key
,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
,h1 BINARY(1), h2 BINARY(9), h3 BINARY(255)
,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
) engine ndb;
insert into t1 values
(1
,'1','12345678901234567890123456789012','123456789 '
  ,'1   ','12345678901234567890123456789012  ','123456789 '
  ,0x20,0x123456789abcdef020, 0x012345000020
,0x1200000020,0x123456789abcdef000000020, 0x00123450000020
);
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
@the_backup_id:=backup_id
<the_backup_id>
DROP TABLE test.backup_info;
'1';'1';'12345678901234567890123456789012';'123456789';'1';'12345678901234567890123456789012';'123456789';'0x20';'0x123456789ABCDEF020';'0x012345000020';'0x1200000020';'0x123456789ABCDEF000000020';'0x00123450000020'
drop table t1;

--- New file ---
+++ mysql-test/t/ndb_restore_print.test	07/03/01 12:40:17
-- source include/have_ndb.inc
-- source include/ndb_default_cluster.inc
-- source include/not_embedded.inc

--disable_warnings
use test;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--enable_warnings

# basic datatypes
create table t1
 (pk int key
  ,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
  ,b1 TINYINT, b2 TINYINT UNSIGNED
  ,c1 SMALLINT, c2 SMALLINT UNSIGNED
  ,d1 INT, d2 INT UNSIGNED
  ,e1 BIGINT, e2 BIGINT UNSIGNED
  ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
  ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
  ,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
  ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
 ) engine ndb;

# max values
insert into t1 values
 (1
  ,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
  ,127, 255
  ,32767, 65535
  ,2147483647, 4294967295
  ,9223372036854775807, 18446744073709551615
  ,'1','12345678901234567890123456789012','123456789'
  ,'1','12345678901234567890123456789012','123456789'
  ,0x12,0x123456789abcdef0, 0x012345
  ,0x12,0x123456789abcdef0, 0x00123450
 );

# min values
insert into t1 values
 (2
  ,0, 0, 0, 0, 0
  ,-128, 0
  ,-32768, 0
  ,-2147483648, 0
  ,-9223372036854775808, 0
  ,'','',''
  ,'','',''
  ,0x0,0x0,0x0
  ,0x0,0x0,0x0
 );

# null values
insert into t1 values
 (3
  ,NULL,NULL,NULL,NULL,NULL
  ,NULL,NULL
  ,NULL,NULL
  ,NULL,NULL
  ,NULL,NULL
  ,NULL,NULL,NULL
  ,NULL,NULL,NULL
  ,NULL,NULL,NULL
  ,NULL,NULL,NULL
 );

--source include/ndb_backup.inc
--let ndb_restore_opts=--print_data --hex --fields-terminated-by=";"
--source include/ndb_backup_print.inc
--let ndb_restore_opts=--print_data --hex --fields-terminated-by="," --fields-optionally-enclosed-by="'"
--source include/ndb_backup_print.inc


drop table t1;

# some binary char tests with trailing spaces
create table t1
 (pk int key
  ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
  ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
  ,h1 BINARY(1), h2 BINARY(9), h3 BINARY(255)
  ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
 ) engine ndb;

insert into t1 values
 (1
  ,'1','12345678901234567890123456789012','123456789 '
  ,'1   ','12345678901234567890123456789012  ','123456789 '
  ,0x20,0x123456789abcdef020, 0x012345000020
  ,0x1200000020,0x123456789abcdef000000020, 0x00123450000020
 );

--source include/ndb_backup.inc
--let ndb_restore_opts=--print_data --hex --fields-enclosed-by="'" --fields-optionally-enclosed-by="X"
--source include/ndb_backup_print.inc

# clean up
drop table t1;

Thread
bk commit into 5.1 tree (tomas:1.2442)tomas1 Mar