List:Commits« Previous MessageNext Message »
From:tomas Date:January 22 2007 6:34pm
Subject:bk commit into 5.0 tree (tomas:1.2365) BUG#25746
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.2365 07/01/23 00:34:00 tomas@stripped +3 -0
  bug#25746 ndb: 4209 error with 2 VARCHAR primary keys
  - make sure keys are copied correctly when varchar has 2 length bytes
  - test case

  sql/ha_ndbcluster.cc
    1.295 07/01/23 00:33:54 tomas@stripped +16 -10
    bug#25746 ndb: 4209 error with 2 VARCHAR primary keys
    - make sure keys are copied correctly when varchar has 2 length bytes

  mysql-test/t/ndb_basic.test
    1.37 07/01/23 00:33:54 tomas@stripped +19 -0
    bug#25746 ndb: 4209 error with 2 VARCHAR primary keys
    - test case

  mysql-test/r/ndb_basic.result
    1.36 07/01/23 00:33:54 tomas@stripped +16 -0
    bug#25746 ndb: 4209 error with 2 VARCHAR primary keys
    - test case

# 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-ndb

--- 1.35/mysql-test/r/ndb_basic.result	2006-07-31 18:11:19 +07:00
+++ 1.36/mysql-test/r/ndb_basic.result	2007-01-23 00:33:54 +07:00
@@ -749,3 +749,19 @@
 222222	bbbbbb	2
 drop table t1;
 Illegal ndb error code: 1186
+CREATE TABLE t1 (
+a VARBINARY(40) NOT NULL,
+b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,
+c VARCHAR(256) CHARACTER SET UTF8 NOT NULL,
+PRIMARY KEY (b,c))  ENGINE=ndbcluster;
+INSERT INTO t1 VALUES
+("a","ab","abc"),("b","abc","abcd"),("c","abc","ab"),("d","ab","ab"),("e","abc","abc");
+SELECT * FROM t1 ORDER BY a;
+a	b	c
+a	ab	abc
+b	abc	abcd
+c	abc	ab
+d	ab	ab
+e	abc	abc
+DROP TABLE t1;
+End of 5.0 tests

--- 1.36/mysql-test/t/ndb_basic.test	2006-07-31 18:11:19 +07:00
+++ 1.37/mysql-test/t/ndb_basic.test	2007-01-23 00:33:54 +07:00
@@ -710,3 +710,22 @@
 --error 1
 --exec $MY_PERROR --ndb 1186 2>&1
 
+#
+# Bug #25746 - VARCHAR UTF8 PK issue
+# - prior to bugfix 4209, illegal length parameter would be 
+# returned in SELECT *
+
+CREATE TABLE t1 (
+a VARBINARY(40) NOT NULL,
+b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,
+c VARCHAR(256) CHARACTER SET UTF8 NOT NULL,
+PRIMARY KEY (b,c))  ENGINE=ndbcluster;
+INSERT INTO t1 VALUES
+("a","ab","abc"),("b","abc","abcd"),("c","abc","ab"),("d","ab","ab"),("e","abc","abc");
+SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
+
+# End of 5.0 tests
+--echo End of 5.0 tests
+
+

--- 1.294/sql/ha_ndbcluster.cc	2007-01-08 17:18:17 +07:00
+++ 1.295/sql/ha_ndbcluster.cc	2007-01-23 00:33:54 +07:00
@@ -3144,20 +3144,26 @@
       size_t len = key_part->length;
       const byte * ptr = record + key_part->offset;
       Field *field = key_part->field;
-      if ((field->type() ==  MYSQL_TYPE_VARCHAR) &&
-	  ((Field_varstring*)field)->length_bytes == 1)
+      if (unlikely(field->type() ==  MYSQL_TYPE_VARCHAR))
       {
-	/** 
-	 * Keys always use 2 bytes length
-	 */
-	buff[0] = ptr[0];
-	buff[1] = 0;
-	memcpy(buff+2, ptr + 1, len);	
-	len += 2;
+        if (((Field_varstring*)field)->length_bytes == 1)
+        {
+          /**
+           * Keys always use 2 bytes length
+           */
+          buff[0] = ptr[0];
+          buff[1] = 0;
+          memcpy(buff+2, ptr + 1, len);
+        }
+        else
+        {
+          memcpy(buff, ptr, len + 2);
+        }
+        len += 2;
       }
       else
       {
-	memcpy(buff, ptr, len);
+        memcpy(buff, ptr, len);
       }
       buff += len;
     }
Thread
bk commit into 5.0 tree (tomas:1.2365) BUG#25746tomas22 Jan