Kentoku
null+****@clear*****
Wed Oct 31 04:20:44 JST 2012
Kentoku 2012-10-31 04:20:44 +0900 (Wed, 31 Oct 2012) New Revision: b759e81e47377b33164c87954d4146eaf25cb05c https://github.com/mroonga/mroonga/commit/b759e81e47377b33164c87954d4146eaf25cb05c Log: fix for char index Added files: test/sql/suite/mroonga/storage/index/primary/r/char.result test/sql/suite/mroonga/storage/index/primary/t/char.test Modified files: ha_mroonga.cpp Modified: ha_mroonga.cpp (+7 -0) =================================================================== --- ha_mroonga.cpp 2012-10-29 22:42:21 +0900 (7479eb9) +++ ha_mroonga.cpp 2012-10-31 04:20:44 +0900 (db22821) @@ -9618,6 +9618,13 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key, break; #endif case MYSQL_TYPE_STRING: + { + const char *val = (const char *)ptr; + int len = strlen(val); + memcpy(buf, val, len); + *size = len; + break; + } case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_BLOB: { Added: test/sql/suite/mroonga/storage/index/primary/r/char.result (+9 -0) 100644 =================================================================== --- /dev/null +++ test/sql/suite/mroonga/storage/index/primary/r/char.result 2012-10-31 04:20:44 +0900 (5b895ad) @@ -0,0 +1,9 @@ +drop table if exists t1; +create table t1 (c1 char(10) primary key); +insert into t1 values('abcdefghij'); +insert into t1 values('klmnopqrst'); +insert into t1 values('uvwxyz0123'); +select c1 from t1 force index(PRIMARY) where c1 = 'abcdefghij'; +c1 +abcdefghij +drop table t1; Added: test/sql/suite/mroonga/storage/index/primary/t/char.test (+30 -0) 100644 =================================================================== --- /dev/null +++ test/sql/suite/mroonga/storage/index/primary/t/char.test 2012-10-31 04:20:44 +0900 (fcec696) @@ -0,0 +1,30 @@ +# Copyright(C) 2012 Kentoku SHIBA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +--source include/have_mroonga.inc + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (c1 char(10) primary key); +insert into t1 values('abcdefghij'); +insert into t1 values('klmnopqrst'); +insert into t1 values('uvwxyz0123'); +select c1 from t1 force index(PRIMARY) where c1 = 'abcdefghij'; +drop table t1; + +--source include/have_mroonga_deinit.inc -------------- next part -------------- HTML����������������������������...Download