From: Date: December 14 2005 3:09pm Subject: bk commit into 5.0 tree (jonas:1.2001) BUG#15682 List-Archive: http://lists.mysql.com/internals/33244 X-Bug: 15682 Message-Id: <20051214140917.0E0DA2344A8@perch.ndb.mysql.com> Below is the list of changes that have just been committed into a local 5.0 repository of jonas. When jonas 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.2001 05/12/14 15:09:12 jonas@stripped +3 -0 bug#15682 - ndb incorrect handling of varchar in position/rnd_pos Commit for 5.0.17 release clone sql/ha_ndbcluster.cc 1.223 05/12/14 15:09:09 jonas@stripped +19 -2 bug#15682 mysql-test/t/ndb_basic.test 1.33 05/12/14 15:09:09 jonas@stripped +11 -0 bug#15682 mysql-test/r/ndb_basic.result 1.32 05/12/14 15:09:09 jonas@stripped +16 -0 bug#15682 # 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: jonas # Host: perch.ndb.mysql.com # Root: /home/jonas/src/mysql-5.0-release --- 1.31/mysql-test/r/ndb_basic.result 2005-11-25 16:53:49 +01:00 +++ 1.32/mysql-test/r/ndb_basic.result 2005-12-14 15:09:09 +01:00 @@ -677,3 +677,19 @@ a 2 drop table atablewithareallylongandirritatingname; +create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB; +insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1); +insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2); +select * from t1 order by f1; +f1 f2 f3 +111111 aaaaaa 1 +222222 bbbbbb 2 +select * from t1 order by f2; +f1 f2 f3 +111111 aaaaaa 1 +222222 bbbbbb 2 +select * from t1 order by f3; +f1 f2 f3 +111111 aaaaaa 1 +222222 bbbbbb 2 +drop table t1; --- 1.32/mysql-test/t/ndb_basic.test 2005-11-25 11:57:07 +01:00 +++ 1.33/mysql-test/t/ndb_basic.test 2005-12-14 15:09:09 +01:00 @@ -623,3 +623,14 @@ insert into atablewithareallylongandirritatingname values (2); select * from atablewithareallylongandirritatingname; drop table atablewithareallylongandirritatingname; + +# +# Bug#15682 +# +create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB; +insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1); +insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2); +select * from t1 order by f1; +select * from t1 order by f2; +select * from t1 order by f3; +drop table t1; --- 1.222/sql/ha_ndbcluster.cc 2005-11-25 11:57:07 +01:00 +++ 1.223/sql/ha_ndbcluster.cc 2005-12-14 15:09:09 +01:00 @@ -2812,8 +2812,25 @@ } *buff++= 0; } - memcpy(buff, record + key_part->offset, key_part->length); - buff += key_part->length; + 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) + { + /** + * Keys always use 2 bytes length + */ + buff[0] = ptr[0]; + buff[1] = 0; + memcpy(buff+2, ptr + 1, len); + len += 2; + } + else + { + memcpy(buff, ptr, len); + } + buff += len; } } else