Tetsuro IKEDA
null+****@clear*****
Thu Oct 4 10:22:53 JST 2012
Tetsuro IKEDA 2010-11-12 11:48:12 +0900 (Fri, 12 Nov 2010) New Revision: 409ecd5b74a5fdf7e1d89af342c41d8a5e65b666 https://github.com/mroonga/mroonga/commit/409ecd5b74a5fdf7e1d89af342c41d8a5e65b666 Log: skipping virtual columns when creating actual columns. Modified files: ha_mroonga.cc test/sql/r/create_table.result test/sql/t/create_table.test Modified: ha_mroonga.cc (+4 -0) =================================================================== --- ha_mroonga.cc 2010-11-10 18:50:33 +0900 (00bda4c) +++ ha_mroonga.cc 2010-11-12 11:48:12 +0900 (44d6e14) @@ -839,6 +839,10 @@ int ha_mroonga::create(const char *name, TABLE *table, HA_CREATE_INFO *info) Field *field = table->s->field[i]; const char *col_name = field->field_name; int col_name_size = strlen(col_name); + + if (strncmp(MRN_ID_COL_NAME, col_name, col_name_size) == 0) continue; + if (strncmp(MRN_SCORE_COL_NAME, col_name, col_name_size) == 0) continue; + grn_obj_flags col_flags = GRN_OBJ_PERSISTENT | GRN_OBJ_COLUMN_SCALAR; int mysql_field_type = field->type(); grn_builtin_type gtype = mrn_get_type(ctx, mysql_field_type); Modified: test/sql/r/create_table.result (+12 -0) =================================================================== --- test/sql/r/create_table.result 2010-11-10 18:50:33 +0900 (d441175) +++ test/sql/r/create_table.result 2010-11-12 11:48:12 +0900 (585726c) @@ -148,6 +148,18 @@ desc t1; Field Type Null Key Default Extra c1 set('A','B','AB','O') YES NULL drop table t1; +create table t1 (c1 int, `_id` int) engine = groonga; +desc t1; +Field Type Null Key Default Extra +c1 int(11) YES NULL +_id int(11) YES NULL +drop table t1; +create table t1 (c1 int, `_score` float) engine = groonga; +desc t1; +Field Type Null Key Default Extra +c1 int(11) YES NULL +_score float YES NULL +drop table t1; create table `_aaa` (c1 int) engine = groonga; ERROR HY000: name can't start with '_' and 0-9, and contains only 0-9, A-Z, a-z, or _ create table t1 (c1 int, `_id` text) engine = groonga; Modified: test/sql/t/create_table.test (+8 -0) =================================================================== --- test/sql/t/create_table.test 2010-11-10 18:50:33 +0900 (7a1f6b4) +++ test/sql/t/create_table.test 2010-11-12 11:48:12 +0900 (422dac5) @@ -115,6 +115,14 @@ create table t1 (c1 set("A","B","AB","O")); desc t1; drop table t1; +# virtual columns +create table t1 (c1 int, `_id` int) engine = groonga; +desc t1; +drop table t1; +create table t1 (c1 int, `_score` float) engine = groonga; +desc t1; +drop table t1; + # error --error 1005 create table `_aaa` (c1 int) engine = groonga; -------------- next part -------------- HTML����������������������������...Télécharger