Kouhei Sutou
null+****@clear*****
Sat Feb 27 16:19:37 JST 2016
Kouhei Sutou 2016-02-27 16:19:37 +0900 (Sat, 27 Feb 2016) New Revision: 07d46feb215421d7147636e24f5a301f1f41a6c1 https://github.com/groonga/groonga/commit/07d46feb215421d7147636e24f5a301f1f41a6c1 Message: object_inspect: support table's value type Modified files: lib/proc/proc_object_inspect.c test/command/suite/object_inspect/db.expected test/command/suite/object_inspect/table_dat_key.expected test/command/suite/object_inspect/table_hash_key.expected test/command/suite/object_inspect/table_hash_key.test test/command/suite/object_inspect/table_no_key.expected test/command/suite/object_inspect/table_no_key.test test/command/suite/object_inspect/table_pat_key.expected test/command/suite/object_inspect/table_pat_key.test Modified: lib/proc/proc_object_inspect.c (+18 -0) =================================================================== --- lib/proc/proc_object_inspect.c 2016-02-27 16:14:08 +0900 (592bb07) +++ lib/proc/proc_object_inspect.c 2016-02-27 16:19:37 +0900 (7b6888c) @@ -137,6 +137,22 @@ command_object_inspect_table_key(grn_ctx *ctx, grn_obj *table) } static void +command_object_inspect_table_value(grn_ctx *ctx, grn_obj *table) +{ + if (table->header.type == GRN_TABLE_DAT_KEY) { + grn_ctx_output_null(ctx); + } else { + grn_ctx_output_map_open(ctx, "value", 1); + { + grn_id range_id = grn_obj_get_range(ctx, table); + grn_ctx_output_cstr(ctx, "type"); + command_object_inspect_type(ctx, grn_ctx_at(ctx, range_id)); + } + grn_ctx_output_map_close(ctx); + } +} + +static void command_object_inspect_table(grn_ctx *ctx, grn_obj *obj) { grn_ctx_output_map_open(ctx, "table", 6); @@ -149,6 +165,8 @@ command_object_inspect_table(grn_ctx *ctx, grn_obj *obj) command_object_inspect_obj_type(ctx, obj->header.type); grn_ctx_output_cstr(ctx, "key"); command_object_inspect_table_key(ctx, obj); + grn_ctx_output_cstr(ctx, "value"); + command_object_inspect_table_value(ctx, obj); } grn_ctx_output_map_close(ctx); } Modified: test/command/suite/object_inspect/db.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/db.expected 2016-02-27 16:14:08 +0900 (6b18410) +++ test/command/suite/object_inspect/db.expected 2016-02-27 16:19:37 +0900 (f3aea43) @@ -19,7 +19,8 @@ object_inspect }, "key": { "type": null - } + }, + "value": null } } ] Modified: test/command/suite/object_inspect/table_dat_key.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/table_dat_key.expected 2016-02-27 16:14:08 +0900 (b9cdfef) +++ test/command/suite/object_inspect/table_dat_key.expected 2016-02-27 16:19:37 +0900 (a092a0b) @@ -30,6 +30,7 @@ object_inspect Users }, "size": 4096 } - } + }, + "value": null } ] Modified: test/command/suite/object_inspect/table_hash_key.expected (+12 -1) =================================================================== --- test/command/suite/object_inspect/table_hash_key.expected 2016-02-27 16:14:08 +0900 (73ac890) +++ test/command/suite/object_inspect/table_hash_key.expected 2016-02-27 16:19:37 +0900 (f0ca73c) @@ -1,4 +1,4 @@ -table_create Users TABLE_HASH_KEY ShortText +table_create Users TABLE_HASH_KEY ShortText Int32 [[0,0.0,0.0],true] load --table Users [ @@ -32,6 +32,17 @@ object_inspect Users }, "total_size": 5, "max_total_size": 4294967295 + }, + "value": { + "type": { + "id": 8, + "name": "Int32", + "type": { + "id": 32, + "name": "type" + }, + "size": 4 + } } } ] Modified: test/command/suite/object_inspect/table_hash_key.test (+1 -1) =================================================================== --- test/command/suite/object_inspect/table_hash_key.test 2016-02-27 16:14:08 +0900 (827849f) +++ test/command/suite/object_inspect/table_hash_key.test 2016-02-27 16:19:37 +0900 (f6063a4) @@ -1,4 +1,4 @@ -table_create Users TABLE_HASH_KEY ShortText +table_create Users TABLE_HASH_KEY ShortText Int32 load --table Users [ Modified: test/command/suite/object_inspect/table_no_key.expected (+16 -5) =================================================================== --- test/command/suite/object_inspect/table_no_key.expected 2016-02-27 16:14:08 +0900 (a2501e7) +++ test/command/suite/object_inspect/table_no_key.expected 2016-02-27 16:19:37 +0900 (d6f46ed) @@ -1,12 +1,12 @@ -table_create Users TABLE_NO_KEY +table_create Points TABLE_NO_KEY --value_type WGS84GeoPoint [[0,0.0,0.0],true] -load --table Users +load --table Points [ {}, {} ] [[0,0.0,0.0],2] -object_inspect Users +object_inspect Points [ [ 0, @@ -15,11 +15,22 @@ object_inspect Users ], { "id": 256, - "name": "Users", + "name": "Points", "type": { "id": 51, "name": "table:no_key" }, - "key": null + "key": null, + "value": { + "type": { + "id": 18, + "name": "WGS84GeoPoint", + "type": { + "id": 32, + "name": "type" + }, + "size": 8 + } + } } ] Modified: test/command/suite/object_inspect/table_no_key.test (+3 -3) =================================================================== --- test/command/suite/object_inspect/table_no_key.test 2016-02-27 16:14:08 +0900 (773ad5b) +++ test/command/suite/object_inspect/table_no_key.test 2016-02-27 16:19:37 +0900 (c374e0f) @@ -1,9 +1,9 @@ -table_create Users TABLE_NO_KEY +table_create Points TABLE_NO_KEY --value_type WGS84GeoPoint -load --table Users +load --table Points [ {}, {} ] -object_inspect Users +object_inspect Points Modified: test/command/suite/object_inspect/table_pat_key.expected (+12 -1) =================================================================== --- test/command/suite/object_inspect/table_pat_key.expected 2016-02-27 16:14:08 +0900 (4c2681b) +++ test/command/suite/object_inspect/table_pat_key.expected 2016-02-27 16:19:37 +0900 (4dc7560) @@ -1,4 +1,4 @@ -table_create Users TABLE_PAT_KEY ShortText +table_create Users TABLE_PAT_KEY ShortText Time [[0,0.0,0.0],true] load --table Users [ @@ -32,6 +32,17 @@ object_inspect Users }, "total_size": 5, "max_total_size": 4294967294 + }, + "value": { + "type": { + "id": 13, + "name": "Time", + "type": { + "id": 32, + "name": "type" + }, + "size": 8 + } } } ] Modified: test/command/suite/object_inspect/table_pat_key.test (+1 -1) =================================================================== --- test/command/suite/object_inspect/table_pat_key.test 2016-02-27 16:14:08 +0900 (bb2df80) +++ test/command/suite/object_inspect/table_pat_key.test 2016-02-27 16:19:37 +0900 (450e742) @@ -1,4 +1,4 @@ -table_create Users TABLE_PAT_KEY ShortText +table_create Users TABLE_PAT_KEY ShortText Time load --table Users [ -------------- next part -------------- HTML����������������������������...Download