Kouhei Sutou
null+****@clear*****
Sat Aug 3 12:20:11 JST 2013
Kouhei Sutou 2013-08-03 12:20:11 +0900 (Sat, 03 Aug 2013) New Revision: 526883658751b29b0f73315d2ebaa2e677d551f3 https://github.com/groonga/groonga/commit/526883658751b29b0f73315d2ebaa2e677d551f3 Message: Extract code that removes array table Added files: test/command/suite/table_remove/array/with_columns.expected test/command/suite/table_remove/array/with_columns.test test/command/suite/table_remove/array/without_columns.expected test/command/suite/table_remove/array/without_columns.test Modified files: lib/db.c Modified: lib/db.c (+15 -8) =================================================================== --- lib/db.c 2013-08-03 12:16:18 +0900 (c273f28) +++ lib/db.c 2013-08-03 12:20:11 +0900 (04cee56) @@ -6685,6 +6685,20 @@ _grn_obj_remove_hash(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id, } static void +_grn_obj_remove_array(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id, + const char *path) +{ + 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_array_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; @@ -6722,14 +6736,7 @@ _grn_obj_remove(grn_ctx *ctx, grn_obj *obj) _grn_obj_remove_hash(ctx, obj, db, id, path); break; case GRN_TABLE_NO_KEY : - 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_array_remove(ctx, path); - } - grn_obj_touch(ctx, db, NULL); + _grn_obj_remove_array(ctx, obj, db, id, path); break; case GRN_COLUMN_VAR_SIZE : remove_index(ctx, obj, GRN_HOOK_SET); Added: test/command/suite/table_remove/array/with_columns.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/with_columns.expected 2013-08-03 12:20:11 +0900 (25ea486) @@ -0,0 +1,11 @@ +table_create Users TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Users name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +dump +table_create Users TABLE_NO_KEY +column_create Users name COLUMN_SCALAR ShortText + +table_remove Users +[[0,0.0,0.0],true] +dump Added: test/command/suite/table_remove/array/with_columns.test (+8 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/with_columns.test 2013-08-03 12:20:11 +0900 (7574706) @@ -0,0 +1,8 @@ +table_create Users TABLE_NO_KEY +column_create Users name COLUMN_SCALAR ShortText + +dump + +table_remove Users + +dump Added: test/command/suite/table_remove/array/without_columns.expected (+8 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/without_columns.expected 2013-08-03 12:20:11 +0900 (4e271c9) @@ -0,0 +1,8 @@ +table_create Names TABLE_NO_KEY +[[0,0.0,0.0],true] +dump +table_create Names TABLE_NO_KEY + +table_remove Names +[[0,0.0,0.0],true] +dump Added: test/command/suite/table_remove/array/without_columns.test (+7 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/without_columns.test 2013-08-03 12:20:11 +0900 (eb5dab3) @@ -0,0 +1,7 @@ +table_create Names TABLE_NO_KEY + +dump + +table_remove Names + +dump -------------- next part -------------- HTML����������������������������...Download