Kouhei Sutou
null+****@clear*****
Sat Aug 3 15:49:20 JST 2013
Kouhei Sutou 2013-08-03 15:49:20 +0900 (Sat, 03 Aug 2013) New Revision: 20a5dd9248f099fac78b3b80cc19b261a5e61eac https://github.com/groonga/groonga/commit/20a5dd9248f099fac78b3b80cc19b261a5e61eac Message: Extract code that removes variable size column Added files: test/command/suite/column_remove/variable_size/with_index.expected test/command/suite/column_remove/variable_size/with_index.test test/command/suite/column_remove/variable_size/without_index.expected test/command/suite/column_remove/variable_size/without_index.test Modified files: lib/db.c Modified: lib/db.c (+15 -8) =================================================================== --- lib/db.c 2013-08-03 12:20:11 +0900 (04cee56) +++ lib/db.c 2013-08-03 15:49:20 +0900 (3e672fd) @@ -6699,6 +6699,20 @@ _grn_obj_remove_array(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id, } static void +_grn_obj_remove_ja(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id, + const char *path) +{ + remove_index(ctx, obj, GRN_HOOK_SET); + grn_obj_close(ctx, obj); + if (path) { + grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL); + grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); + grn_ja_remove(ctx, path); + } + grn_obj_touch(ctx, db, NULL); +} + +static void _grn_obj_remove(grn_ctx *ctx, grn_obj *obj) { grn_id id = GRN_ID_NIL; @@ -6739,14 +6753,7 @@ _grn_obj_remove(grn_ctx *ctx, grn_obj *obj) _grn_obj_remove_array(ctx, obj, db, id, path); break; case GRN_COLUMN_VAR_SIZE : - remove_index(ctx, obj, GRN_HOOK_SET); - grn_obj_close(ctx, obj); - if (path) { - grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL); - grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); - grn_ja_remove(ctx, path); - } - grn_obj_touch(ctx, db, NULL); + _grn_obj_remove_ja(ctx, obj, db, id, path); break; case GRN_COLUMN_FIX_SIZE : remove_index(ctx, obj, GRN_HOOK_SET); Added: test/command/suite/column_remove/variable_size/with_index.expected (+20 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/column_remove/variable_size/with_index.expected 2013-08-03 15:49:20 +0900 (b2a988b) @@ -0,0 +1,20 @@ +table_create Users TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Users name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +[[0,0.0,0.0],true] +column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name +[[0,0.0,0.0],true] +dump +table_create Users TABLE_PAT_KEY ShortText +column_create Users name COLUMN_SCALAR ShortText +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto +column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name + +column_remove Users name +[[0,0.0,0.0],true] +dump +table_create Users TABLE_PAT_KEY ShortText +table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto + Added: test/command/suite/column_remove/variable_size/with_index.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/column_remove/variable_size/with_index.test 2013-08-03 15:49:20 +0900 (9981359) @@ -0,0 +1,13 @@ +table_create Users TABLE_PAT_KEY ShortText +column_create Users name COLUMN_SCALAR ShortText + +table_create Terms TABLE_PAT_KEY ShortText \ + --default_tokenizer TokenBigram \ + --normalizer NormalizerAuto +column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name + +dump + +column_remove Users name + +dump Added: test/command/suite/column_remove/variable_size/without_index.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/column_remove/variable_size/without_index.expected 2013-08-03 15:49:20 +0900 (8fa8668) @@ -0,0 +1,13 @@ +table_create Users TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Users name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +dump +table_create Users TABLE_PAT_KEY ShortText +column_create Users name COLUMN_SCALAR ShortText + +column_remove Users name +[[0,0.0,0.0],true] +dump +table_create Users TABLE_PAT_KEY ShortText + Added: test/command/suite/column_remove/variable_size/without_index.test (+8 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/column_remove/variable_size/without_index.test 2013-08-03 15:49:20 +0900 (152ae04) @@ -0,0 +1,8 @@ +table_create Users TABLE_PAT_KEY ShortText +column_create Users name COLUMN_SCALAR ShortText + +dump + +column_remove Users name + +dump -------------- next part -------------- HTML����������������������������... Download