List:Commits« Previous MessageNext Message »
From:tomas Date:March 8 2007 9:38am
Subject:bk commit into 5.0 tree (tomas:1.2401)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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.2401 07/03/08 15:37:53 tomas@stripped +4 -0
  medium int printout support

  ndb/src/ndbapi/NdbRecAttr.cpp
    1.32 07/03/08 15:37:46 tomas@stripped +6 -2
    medium int printout support

  ndb/include/ndbapi/NdbRecAttr.hpp
    1.19 07/03/08 15:37:46 tomas@stripped +31 -0
    medium int printout support

  mysql-test/t/ndb_restore_print.test
    1.3 07/03/08 15:37:45 tomas@stripped +21 -0
    medium int printout support

  mysql-test/r/ndb_restore_print.result
    1.3 07/03/08 15:37:45 tomas@stripped +18 -0
    medium int printout support

# 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.0-telco-gca-ndb_restore

--- 1.18/ndb/include/ndbapi/NdbRecAttr.hpp	2007-03-07 13:18:01 +07:00
+++ 1.19/ndb/include/ndbapi/NdbRecAttr.hpp	2007-03-08 15:37:46 +07:00
@@ -147,6 +147,13 @@ public:
 
   /**
    * Get value stored in NdbRecAttr object.
+   * 
+   * @return  Medium value.
+   */
+  Int32 medium_value() const;
+
+  /**
+   * Get value stored in NdbRecAttr object.
    *
    * @return  Short value.
    */
@@ -176,6 +183,13 @@ public:
   /**
    * Get value stored in NdbRecAttr object.
    * 
+   * @return  Unsigned medium value.
+   */
+  Uint32 u_medium_value() const;
+
+  /**
+   * Get value stored in NdbRecAttr object.
+   * 
    * @return  Unsigned short value.
    */
   Uint16 u_short_value() const;
@@ -319,6 +333,16 @@ NdbRecAttr::int32_value() const 
 }
 
 inline
+Int32
+NdbRecAttr::medium_value() const
+{
+  Uint32 tmp = *(Uint32*)theRef;
+  if (tmp & (0x1<<23))
+    tmp|= (0xFF<<24);
+  return (Int32)tmp;
+}
+
+inline
 short
 NdbRecAttr::short_value() const
 {
@@ -335,6 +359,13 @@ NdbRecAttr::char_value() const
 inline
 Uint32
 NdbRecAttr::u_32_value() const
+{
+  return *(Uint32*)theRef;
+}
+
+inline
+Uint32
+NdbRecAttr::u_medium_value() const
 {
   return *(Uint32*)theRef;
 }

--- 1.31/ndb/src/ndbapi/NdbRecAttr.cpp	2007-03-08 00:26:14 +07:00
+++ 1.32/ndb/src/ndbapi/NdbRecAttr.cpp	2007-03-08 15:37:46 +07:00
@@ -265,6 +265,9 @@ ndbrecattr_print_formatted(NdbOut& out, 
       if (length > 1)
         out << f.end_array_enclosure;
       break;
+    case NdbDictionary::Column::Mediumunsigned:
+      out << r.u_medium_value();
+      break;
     case NdbDictionary::Column::Smallunsigned:
       out << r.u_short_value();
       break;
@@ -277,6 +280,9 @@ ndbrecattr_print_formatted(NdbOut& out, 
     case NdbDictionary::Column::Int:
       out << r.int32_value();
       break;
+    case NdbDictionary::Column::Mediumint:
+      out << r.medium_value();
+      break;
     case NdbDictionary::Column::Smallint:
       out << r.short_value();
       break;
@@ -463,8 +469,6 @@ ndbrecattr_print_formatted(NdbOut& out, 
     break;
 
     case NdbDictionary::Column::Undefined:
-    case NdbDictionary::Column::Mediumint:
-    case NdbDictionary::Column::Mediumunsigned:
     unknown:
     //default: /* no print functions for the rest, just print type */
     out << (int) r.getType();

--- 1.2/mysql-test/r/ndb_restore_print.result	2007-03-08 10:39:24 +07:00
+++ 1.3/mysql-test/r/ndb_restore_print.result	2007-03-08 15:37:45 +07:00
@@ -298,6 +298,24 @@ t4
 4	34
 5	35
 drop table t1;
+create table t1
+(pk int key
+,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
+) engine ndb;
+insert into t1 values(1, 8388607, 16777215);
+insert into t1 values(2, -8388608, 0);
+insert into t1 values(3, -1, 1);
+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;8388607;16777215
+2;-8388608;0
+3;-1;1
+drop table t1;
 drop table t2;
 drop table t3;
 drop table t4;

--- 1.2/mysql-test/t/ndb_restore_print.test	2007-03-08 10:39:25 +07:00
+++ 1.3/mysql-test/t/ndb_restore_print.test	2007-03-08 15:37:45 +07:00
@@ -161,6 +161,27 @@ insert into t4 values (1,31),(2,32),(3,3
 --exec rm -f $MYSQLTEST_VARDIR/tmp/t3.txt
 --exec rm -f $MYSQLTEST_VARDIR/tmp/t4.txt
 
+# now test some other datatypes
+drop table t1;
+create table t1
+ (pk int key
+  ,a1 MEDIUMINT, a2 MEDIUMINT UNSIGNED
+ ) engine ndb;
+
+# max values
+insert into t1 values(1, 8388607, 16777215);
+# min values
+insert into t1 values(2, -8388608, 0);
+# small values
+insert into t1 values(3, -1, 1);
+
+# backup and print
+--source include/ndb_backup.inc
+
+--let ndb_restore_filter=test t1
+--let ndb_restore_opts=--verbose=0 --print_data --hex --fields-terminated-by=";"
+--source include/ndb_backup_print.inc
+
 # clean up
 drop table t1;
 drop table t2;
Thread
bk commit into 5.0 tree (tomas:1.2401)tomas8 Mar