Kouhei Sutou
null+****@clear*****
Sat Aug 3 12:10:07 JST 2013
Kouhei Sutou 2013-08-03 12:10:07 +0900 (Sat, 03 Aug 2013) New Revision: 65af7a0021e3f7c971d30cb720c2f1a3ba09098e https://github.com/groonga/groonga/commit/65af7a0021e3f7c971d30cb720c2f1a3ba09098e Message: Extract code that removes double array trie table Added files: test/command/suite/table_remove/dat/with_columns.expected test/command/suite/table_remove/dat/with_columns.test test/command/suite/table_remove/dat/without_columns.expected test/command/suite/table_remove/dat/without_columns.test Modified files: lib/db.c Modified: lib/db.c (+16 -9) =================================================================== --- lib/db.c 2013-08-03 11:41:58 +0900 (67f7c3f) +++ lib/db.c 2013-08-03 12:10:07 +0900 (76723f6) @@ -6655,6 +6655,21 @@ _grn_obj_remove_pat(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id, } static void +_grn_obj_remove_dat(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id, + const char *path) +{ + remove_index(ctx, obj, GRN_HOOK_INSERT); + remove_columns(ctx, obj); + 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_dat_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; @@ -6686,15 +6701,7 @@ _grn_obj_remove(grn_ctx *ctx, grn_obj *obj) _grn_obj_remove_pat(ctx, obj, db, id, path); break; case GRN_TABLE_DAT_KEY : - remove_index(ctx, obj, GRN_HOOK_INSERT); - remove_columns(ctx, obj); - 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_dat_remove(ctx, path); - } - grn_obj_touch(ctx, db, NULL); + _grn_obj_remove_dat(ctx, obj, db, id, path); break; case GRN_TABLE_HASH_KEY : remove_index(ctx, obj, GRN_HOOK_INSERT); Added: test/command/suite/table_remove/dat/with_columns.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/dat/with_columns.expected 2013-08-03 12:10:07 +0900 (0598783) @@ -0,0 +1,11 @@ +table_create Users TABLE_DAT_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_DAT_KEY ShortText +column_create Users name COLUMN_SCALAR ShortText + +table_remove Users +[[0,0.0,0.0],true] +dump Added: test/command/suite/table_remove/dat/with_columns.test (+8 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/dat/with_columns.test 2013-08-03 12:10:07 +0900 (45d33b3) @@ -0,0 +1,8 @@ +table_create Users TABLE_DAT_KEY ShortText +column_create Users name COLUMN_SCALAR ShortText + +dump + +table_remove Users + +dump Added: test/command/suite/table_remove/dat/without_columns.expected (+8 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/dat/without_columns.expected 2013-08-03 12:10:07 +0900 (8549420) @@ -0,0 +1,8 @@ +table_create Names TABLE_DAT_KEY ShortText +[[0,0.0,0.0],true] +dump +table_create Names TABLE_DAT_KEY ShortText + +table_remove Names +[[0,0.0,0.0],true] +dump Added: test/command/suite/table_remove/dat/without_columns.test (+7 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/dat/without_columns.test 2013-08-03 12:10:07 +0900 (4d27ec4) @@ -0,0 +1,7 @@ +table_create Names TABLE_DAT_KEY ShortText + +dump + +table_remove Names + +dump -------------- next part -------------- HTML����������������������������... 下載