[Groonga-commit] groonga/groonga [master] table_list: use null instead of "null" for GRN_ID_NIL

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri Dec 21 10:08:45 JST 2012


Kouhei Sutou	2012-12-21 10:08:45 +0900 (Fri, 21 Dec 2012)

  New Revision: d894cd62d8bb49a549ab88c51f53d62868ade82a
  https://github.com/groonga/groonga/commit/d894cd62d8bb49a549ab88c51f53d62868ade82a

  Log:
    table_list: use null instead of "null" for GRN_ID_NIL
    
    CAUTION: This is backward incompatible change. If you use table_list
    command and domain and range value of the output, you may change your
    program. "No object" is represented as null (null value) instead of
    "null" (string value) since this change.

  Modified files:
    lib/proc.c
    test/command/suite/table_list/flags/default.expected
    test/command/suite/table_list/flags/key_normalize.expected
    test/command/suite/table_list/flags/key_with_sis.expected
    test/command/suite/table_list/flags/table_dat_key.expected
    test/command/suite/table_list/flags/table_hash_key.expected
    test/command/suite/table_list/flags/table_pat_key.expected
    test/command/suite/table_list/multi_tables.expected

  Modified: lib/proc.c (+15 -6)
===================================================================
--- lib/proc.c    2012-12-21 10:01:33 +0900 (e2cfa68)
+++ lib/proc.c    2012-12-21 10:08:45 +0900 (79551ee)
@@ -1392,6 +1392,18 @@ output_object_name(grn_ctx *ctx, grn_obj *obj)
   GRN_OBJ_FIN(ctx, &bulk);
 }
 
+static void
+output_object_id_name(grn_ctx *ctx, grn_id id)
+{
+  grn_obj *obj = NULL;
+
+  if (id != GRN_ID_NIL) {
+    obj = grn_ctx_at(ctx, id);
+  }
+
+  output_object_name(ctx, obj);
+}
+
 static int
 print_column_info(grn_ctx *ctx, grn_obj *column)
 {
@@ -1580,15 +1592,12 @@ print_table_info(grn_ctx *ctx, grn_obj *table)
   GRN_TEXT_INIT(&o, 0);
   GRN_OUTPUT_ARRAY_OPEN("TABLE", 8);
   GRN_OUTPUT_INT64(id);
-  objid2name(ctx, id, &o);
-  GRN_OUTPUT_OBJ(&o, NULL);
+  output_object_id_name(ctx, id);
   GRN_OUTPUT_CSTR(path);
   grn_table_create_flags_to_text(ctx, &o, table->header.flags);
   GRN_OUTPUT_OBJ(&o, NULL);
-  objid2name(ctx, table->header.domain, &o);
-  GRN_OUTPUT_OBJ(&o, NULL);
-  objid2name(ctx, grn_obj_get_range(ctx, table), &o);
-  GRN_OUTPUT_OBJ(&o, NULL);
+  output_object_id_name(ctx, table->header.domain);
+  output_object_id_name(ctx, grn_obj_get_range(ctx, table));
   default_tokenizer = grn_obj_get_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER,
                                        NULL);
   output_object_name(ctx, default_tokenizer);

  Modified: test/command/suite/table_list/flags/default.expected (+2 -2)
===================================================================
--- test/command/suite/table_list/flags/default.expected    2012-12-21 10:01:33 +0900 (b3f1368)
+++ test/command/suite/table_list/flags/default.expected    2012-12-21 10:08:45 +0900 (a3dc546)
@@ -47,8 +47,8 @@ table_list
       "bookmarks",
       "db/db.0000100",
       "TABLE_HASH_KEY|PERSISTENT",
-      "null",
-      "null",
+      null,
+      null,
       null,
       null
     ]

  Modified: test/command/suite/table_list/flags/key_normalize.expected (+2 -2)
===================================================================
--- test/command/suite/table_list/flags/key_normalize.expected    2012-12-21 10:01:33 +0900 (c2dbf83)
+++ test/command/suite/table_list/flags/key_normalize.expected    2012-12-21 10:08:45 +0900 (c5870d9)
@@ -47,8 +47,8 @@ table_list
       "bookmarks",
       "db/db.0000100",
       "TABLE_PAT_KEY|PERSISTENT",
-      "null",
-      "null",
+      null,
+      null,
       null,
       "NormalizerAuto"
     ]

  Modified: test/command/suite/table_list/flags/key_with_sis.expected (+2 -2)
===================================================================
--- test/command/suite/table_list/flags/key_with_sis.expected    2012-12-21 10:01:33 +0900 (425cc58)
+++ test/command/suite/table_list/flags/key_with_sis.expected    2012-12-21 10:08:45 +0900 (1116ada)
@@ -47,8 +47,8 @@ table_list
       "bookmarks",
       "db/db.0000100",
       "TABLE_PAT_KEY|KEY_WITH_SIS|PERSISTENT",
-      "null",
-      "null",
+      null,
+      null,
       null,
       null
     ]

  Modified: test/command/suite/table_list/flags/table_dat_key.expected (+2 -2)
===================================================================
--- test/command/suite/table_list/flags/table_dat_key.expected    2012-12-21 10:01:33 +0900 (76f4a04)
+++ test/command/suite/table_list/flags/table_dat_key.expected    2012-12-21 10:08:45 +0900 (b74f1dc)
@@ -47,8 +47,8 @@ table_list
       "bookmarks",
       "db/db.0000100",
       "TABLE_DAT_KEY|PERSISTENT",
-      "null",
-      "null",
+      null,
+      null,
       null,
       null
     ]

  Modified: test/command/suite/table_list/flags/table_hash_key.expected (+2 -2)
===================================================================
--- test/command/suite/table_list/flags/table_hash_key.expected    2012-12-21 10:01:33 +0900 (0f30fdf)
+++ test/command/suite/table_list/flags/table_hash_key.expected    2012-12-21 10:08:45 +0900 (6da8768)
@@ -47,8 +47,8 @@ table_list
       "bookmarks",
       "db/db.0000100",
       "TABLE_HASH_KEY|PERSISTENT",
-      "null",
-      "null",
+      null,
+      null,
       null,
       null
     ]

  Modified: test/command/suite/table_list/flags/table_pat_key.expected (+2 -2)
===================================================================
--- test/command/suite/table_list/flags/table_pat_key.expected    2012-12-21 10:01:33 +0900 (96e138f)
+++ test/command/suite/table_list/flags/table_pat_key.expected    2012-12-21 10:08:45 +0900 (c8d212f)
@@ -47,8 +47,8 @@ table_list
       "bookmarks",
       "db/db.0000100",
       "TABLE_PAT_KEY|PERSISTENT",
-      "null",
-      "null",
+      null,
+      null,
       null,
       null
     ]

  Modified: test/command/suite/table_list/multi_tables.expected (+1 -1)
===================================================================
--- test/command/suite/table_list/multi_tables.expected    2012-12-21 10:01:33 +0900 (93b6f2b)
+++ test/command/suite/table_list/multi_tables.expected    2012-12-21 10:08:45 +0900 (5a9fd53)
@@ -60,7 +60,7 @@ table_list
       "db/db.0000100",
       "TABLE_HASH_KEY|PERSISTENT",
       "ShortText",
-      "null",
+      null,
       null,
       null
     ]
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る