Kouhei Sutou
null+****@clear*****
Sat Aug 3 20:56:18 JST 2013
Kouhei Sutou 2013-08-03 20:56:18 +0900 (Sat, 03 Aug 2013) New Revision: 6b62714949e924701d8aeb25b0e513ad5d786a40 https://github.com/groonga/groonga/commit/6b62714949e924701d8aeb25b0e513ad5d786a40 Message: table_remove: add removable check to array table Normally, array table is not referenced but I add the test cases. Because rroonga can use referenced array table. Added files: test/command/suite/table_remove/array/referenced/column_own.expected test/command/suite/table_remove/array/referenced/column_own.test test/command/suite/table_remove/array/referenced/column_scalar.expected test/command/suite/table_remove/array/referenced/column_scalar.test test/command/suite/table_remove/array/referenced/column_vector.expected test/command/suite/table_remove/array/referenced/column_vector.test test/command/suite/table_remove/array/referenced/table_double_trie_array.expected test/command/suite/table_remove/array/referenced/table_double_trie_array.test test/command/suite/table_remove/array/referenced/table_hash.expected test/command/suite/table_remove/array/referenced/table_hash.test test/command/suite/table_remove/array/referenced/table_patricia_trie.expected test/command/suite/table_remove/array/referenced/table_patricia_trie.test Modified files: lib/db.c Modified: lib/db.c (+3 -0) =================================================================== --- lib/db.c 2013-08-03 20:50:46 +0900 (3bded91) +++ lib/db.c 2013-08-03 20:56:18 +0900 (676cea5) @@ -6775,6 +6775,9 @@ static void _grn_obj_remove_array(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id, const char *path) { + if (!is_removable_table(ctx, obj, db)) { + return; + } remove_columns(ctx, obj); grn_obj_close(ctx, obj); if (path) { Added: test/command/suite/table_remove/array/referenced/column_own.expected (+7 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/column_own.expected 2013-08-03 20:56:18 +0900 (4ead1b7) @@ -0,0 +1,7 @@ +table_create Names TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Names nick_name COLUMN_SCALAR Names +[[0,0.0,0.0],true] +table_remove Names +[[0,0.0,0.0],true] +dump Added: test/command/suite/table_remove/array/referenced/column_own.test (+6 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/column_own.test 2013-08-03 20:56:18 +0900 (d6fbf85) @@ -0,0 +1,6 @@ +table_create Names TABLE_NO_KEY +column_create Names nick_name COLUMN_SCALAR Names + +table_remove Names + +dump Added: test/command/suite/table_remove/array/referenced/column_scalar.expected (+24 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/column_scalar.expected 2013-08-03 20:56:18 +0900 (8c78303) @@ -0,0 +1,24 @@ +table_create Names TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Users name COLUMN_SCALAR Names +[[0,0.0,0.0],true] +table_remove Names +[ + [ + [ + -2, + 0.0, + 0.0 + ], + "[table][remove] a column that references the table exists: <Users.name> -> <Names>" + ], + false +] +#|e| [table][remove] a column that references the table exists: <Users.name> -> <Names> +dump +table_create Names TABLE_NO_KEY +table_create Users TABLE_HASH_KEY ShortText +column_create Users name COLUMN_SCALAR Names + Added: test/command/suite/table_remove/array/referenced/column_scalar.test (+7 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/column_scalar.test 2013-08-03 20:56:18 +0900 (350fb24) @@ -0,0 +1,7 @@ +table_create Names TABLE_NO_KEY +table_create Users TABLE_HASH_KEY ShortText +column_create Users name COLUMN_SCALAR Names + +table_remove Names + +dump Added: test/command/suite/table_remove/array/referenced/column_vector.expected (+24 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/column_vector.expected 2013-08-03 20:56:18 +0900 (1dee92b) @@ -0,0 +1,24 @@ +table_create Names TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Users name COLUMN_VECTOR Names +[[0,0.0,0.0],true] +table_remove Names +[ + [ + [ + -2, + 0.0, + 0.0 + ], + "[table][remove] a column that references the table exists: <Users.name> -> <Names>" + ], + false +] +#|e| [table][remove] a column that references the table exists: <Users.name> -> <Names> +dump +table_create Names TABLE_NO_KEY +table_create Users TABLE_HASH_KEY ShortText +column_create Users name COLUMN_VECTOR Names + Added: test/command/suite/table_remove/array/referenced/column_vector.test (+7 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/column_vector.test 2013-08-03 20:56:18 +0900 (288a602) @@ -0,0 +1,7 @@ +table_create Names TABLE_NO_KEY +table_create Users TABLE_HASH_KEY ShortText +column_create Users name COLUMN_VECTOR Names + +table_remove Names + +dump Added: test/command/suite/table_remove/array/referenced/table_double_trie_array.expected (+21 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/table_double_trie_array.expected 2013-08-03 20:56:18 +0900 (ba3acde) @@ -0,0 +1,21 @@ +table_create Names TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Users TABLE_DAT_KEY Names +[[0,0.0,0.0],true] +table_remove Names +[ + [ + [ + -2, + 0.0, + 0.0 + ], + "[table][remove] a table that references the table exists: <Users._key> -> <Names>" + ], + false +] +#|e| [table][remove] a table that references the table exists: <Users._key> -> <Names> +dump +table_create Names TABLE_NO_KEY +table_create Users TABLE_DAT_KEY Names + Added: test/command/suite/table_remove/array/referenced/table_double_trie_array.test (+6 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/table_double_trie_array.test 2013-08-03 20:56:18 +0900 (7322820) @@ -0,0 +1,6 @@ +table_create Names TABLE_NO_KEY +table_create Users TABLE_DAT_KEY Names + +table_remove Names + +dump Added: test/command/suite/table_remove/array/referenced/table_hash.expected (+21 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/table_hash.expected 2013-08-03 20:56:18 +0900 (24c5365) @@ -0,0 +1,21 @@ +table_create Names TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Users TABLE_HASH_KEY Names +[[0,0.0,0.0],true] +table_remove Names +[ + [ + [ + -2, + 0.0, + 0.0 + ], + "[table][remove] a table that references the table exists: <Users._key> -> <Names>" + ], + false +] +#|e| [table][remove] a table that references the table exists: <Users._key> -> <Names> +dump +table_create Names TABLE_NO_KEY +table_create Users TABLE_HASH_KEY Names + Added: test/command/suite/table_remove/array/referenced/table_hash.test (+6 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/table_hash.test 2013-08-03 20:56:18 +0900 (4d73e67) @@ -0,0 +1,6 @@ +table_create Names TABLE_NO_KEY +table_create Users TABLE_HASH_KEY Names + +table_remove Names + +dump Added: test/command/suite/table_remove/array/referenced/table_patricia_trie.expected (+21 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/table_patricia_trie.expected 2013-08-03 20:56:18 +0900 (1e7b1c7) @@ -0,0 +1,21 @@ +table_create Names TABLE_NO_KEY +[[0,0.0,0.0],true] +table_create Users TABLE_PAT_KEY Names +[[0,0.0,0.0],true] +table_remove Names +[ + [ + [ + -2, + 0.0, + 0.0 + ], + "[table][remove] a table that references the table exists: <Users._key> -> <Names>" + ], + false +] +#|e| [table][remove] a table that references the table exists: <Users._key> -> <Names> +dump +table_create Names TABLE_NO_KEY +table_create Users TABLE_PAT_KEY Names + Added: test/command/suite/table_remove/array/referenced/table_patricia_trie.test (+6 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/table_remove/array/referenced/table_patricia_trie.test 2013-08-03 20:56:18 +0900 (27a6016) @@ -0,0 +1,6 @@ +table_create Names TABLE_NO_KEY +table_create Users TABLE_PAT_KEY Names + +table_remove Names + +dump -------------- next part -------------- HTML����������������������������... 다운로드