[Groonga-commit] groonga/groonga at 56a3f92 [master] object_inspect: support DB

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 26 15:28:14 JST 2016


Kouhei Sutou	2016-02-26 15:28:14 +0900 (Fri, 26 Feb 2016)

  New Revision: 56a3f9252208fc82de93cddf8a6287fdf0ce226b
  https://github.com/groonga/groonga/commit/56a3f9252208fc82de93cddf8a6287fdf0ce226b

  Message:
    object_inspect: support DB

  Added files:
    test/command/suite/object_inspect/db.expected
    test/command/suite/object_inspect/db.test
  Modified files:
    lib/proc/proc_object_inspect.c

  Modified: lib/proc/proc_object_inspect.c (+19 -0)
===================================================================
--- lib/proc/proc_object_inspect.c    2016-02-26 15:13:04 +0900 (4fca92b)
+++ lib/proc/proc_object_inspect.c    2016-02-26 15:28:14 +0900 (3e2aba8)
@@ -53,6 +53,7 @@ command_object_inspect_type(grn_ctx *ctx, grn_obj *type)
 {
   if (!type) {
     grn_ctx_output_null(ctx);
+    return;
   }
 
   grn_ctx_output_map_open(ctx, "type", 4);
@@ -172,6 +173,21 @@ command_object_inspect_table_dat_key(grn_ctx *ctx, grn_obj *obj)
 }
 
 static void
+command_object_inspect_db(grn_ctx *ctx, grn_obj *obj)
+{
+  grn_db *db = (grn_db *)obj;
+
+  grn_ctx_output_map_open(ctx, "database", 2);
+  {
+    grn_ctx_output_cstr(ctx, "type");
+    command_object_inspect_obj_type(ctx, obj->header.type);
+    grn_ctx_output_cstr(ctx, "keys");
+    command_object_inspect_dispatch(ctx, db->keys);
+  }
+  grn_ctx_output_map_close(ctx);
+}
+
+static void
 command_object_inspect_dispatch(grn_ctx *ctx, grn_obj *obj)
 {
   switch (obj->header.type) {
@@ -187,6 +203,9 @@ command_object_inspect_dispatch(grn_ctx *ctx, grn_obj *obj)
   case GRN_TABLE_DAT_KEY :
     command_object_inspect_table_dat_key(ctx, obj);
     break;
+  case GRN_DB :
+    command_object_inspect_db(ctx, obj);
+    break;
   default :
     {
       GRN_PLUGIN_ERROR(ctx,

  Added: test/command/suite/object_inspect/db.expected (+25 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/object_inspect/db.expected    2016-02-26 15:28:14 +0900 (13e3f03)
@@ -0,0 +1,25 @@
+object_inspect
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  {
+    "type": {
+      "id": 55,
+      "name": "db"
+    },
+    "keys": {
+      "id": 0,
+      "name": "",
+      "type": {
+        "id": 50,
+        "name": "table:dat_key"
+      },
+      "key": {
+        "type": null
+      }
+    }
+  }
+]

  Added: test/command/suite/object_inspect/db.test (+1 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/object_inspect/db.test    2016-02-26 15:28:14 +0900 (f3fa166)
@@ -0,0 +1 @@
+object_inspect
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index