[Groonga-commit] groonga/groonga at 24479eb [master] Don't show all keys by inspect

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Nov 18 12:16:09 JST 2015


Kouhei Sutou	2015-11-18 12:16:09 +0900 (Wed, 18 Nov 2015)

  New Revision: 24479eb56894976e1325efe63f9520f2b83fb89d
  https://github.com/groonga/groonga/commit/24479eb56894976e1325efe63f9520f2b83fb89d

  Message:
    Don't show all keys by inspect
    
    Because large table inspect is painful.

  Modified files:
    lib/util.c

  Modified: lib/util.c (+8 -0)
===================================================================
--- lib/util.c    2015-11-18 12:08:58 +0900 (c99a3ba)
+++ lib/util.c    2015-11-18 12:16:09 +0900 (d6fbfeb)
@@ -753,6 +753,10 @@ static grn_rc
 grn_table_keys_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
 {
   grn_table_cursor *tc;
+  int max_n_keys = 10;
+
+  /* TODO */
+  /* max_n_keys = grn_atoi(grn_getenv("GRN_INSPECT_TABLE_MAX_N_KEYS")); */
 
   GRN_TEXT_PUTS(ctx, buf, "keys:[");
   tc = grn_table_cursor_open(ctx, obj, NULL, 0, NULL, 0,
@@ -763,6 +767,10 @@ grn_table_keys_inspect(grn_ctx *ctx, grn_obj *buf, grn_obj *obj)
     grn_obj key;
     GRN_OBJ_INIT(&key, GRN_BULK, 0, obj->header.domain);
     while ((id = grn_table_cursor_next(ctx, tc))) {
+      if (max_n_keys > 0 && i >= max_n_keys) {
+        GRN_TEXT_PUTS(ctx, buf, ", ...");
+        break;
+      }
       if (i++ > 0) { GRN_TEXT_PUTS(ctx, buf, ", "); }
       grn_table_get_key2(ctx, obj, id, &key);
       grn_inspect(ctx, buf, &key);
-------------- next part --------------
HTML����������������������������...
Download 



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