[Groonga-commit] groonga/groonga at 2da5054 [master] Extract code that removes patricia trie table

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 3 11:38:51 JST 2013


Kouhei Sutou	2013-08-03 11:38:51 +0900 (Sat, 03 Aug 2013)

  New Revision: 2da5054c370178c0da41108533a8305483230a3b
  https://github.com/groonga/groonga/commit/2da5054c370178c0da41108533a8305483230a3b

  Message:
    Extract code that removes patricia trie table

  Added files:
    test/command/suite/table_remove/pat/with_columns.actual
    test/command/suite/table_remove/pat/with_columns.test
    test/command/suite/table_remove/pat/without_columns.expected
    test/command/suite/table_remove/pat/without_columns.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+16 -9)
===================================================================
--- lib/db.c    2013-08-03 11:25:16 +0900 (d2329cd)
+++ lib/db.c    2013-08-03 11:38:51 +0900 (67f7c3f)
@@ -6640,6 +6640,21 @@ _grn_obj_remove_db(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
 }
 
 static void
+_grn_obj_remove_pat(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
+                    const char *path)
+{
+  remove_index(ctx, obj, GRN_HOOK_INSERT);
+  remove_columns(ctx, obj);
+  grn_obj_close(ctx, obj);
+  if (path) {
+    grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
+    grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
+    grn_pat_remove(ctx, path);
+  }
+  grn_obj_touch(ctx, db, NULL);
+}
+
+static void
 _grn_obj_remove(grn_ctx *ctx, grn_obj *obj)
 {
   grn_id id = GRN_ID_NIL;
@@ -6668,15 +6683,7 @@ _grn_obj_remove(grn_ctx *ctx, grn_obj *obj)
     _grn_obj_remove_db(ctx, obj, db, id, path);
     break;
   case GRN_TABLE_PAT_KEY :
-    remove_index(ctx, obj, GRN_HOOK_INSERT);
-    remove_columns(ctx, obj);
-    grn_obj_close(ctx, obj);
-    if (path) {
-      grn_ja_put(ctx, ((grn_db *)db)->specs, id, NULL, 0, GRN_OBJ_SET, NULL);
-      grn_obj_delete_by_id(ctx, db, id, GRN_TRUE);
-      grn_pat_remove(ctx, path);
-    }
-    grn_obj_touch(ctx, db, NULL);
+    _grn_obj_remove_pat(ctx, obj, db, id, path);
     break;
   case GRN_TABLE_DAT_KEY :
     remove_index(ctx, obj, GRN_HOOK_INSERT);

  Added: test/command/suite/table_remove/pat/with_columns.actual (+11 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_remove/pat/with_columns.actual    2013-08-03 11:38:51 +0900 (2e79853)
@@ -0,0 +1,11 @@
+table_create Users TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+dump
+table_create Users TABLE_PAT_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+
+table_remove Users
+[[0,0.0,0.0],true]
+dump

  Added: test/command/suite/table_remove/pat/with_columns.test (+8 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_remove/pat/with_columns.test    2013-08-03 11:38:51 +0900 (e87a615)
@@ -0,0 +1,8 @@
+table_create Users TABLE_PAT_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+
+dump
+
+table_remove Users
+
+dump

  Added: test/command/suite/table_remove/pat/without_columns.expected (+8 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_remove/pat/without_columns.expected    2013-08-03 11:38:51 +0900 (edfcf70)
@@ -0,0 +1,8 @@
+table_create Names TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+dump
+table_create Names TABLE_PAT_KEY ShortText
+
+table_remove Names
+[[0,0.0,0.0],true]
+dump

  Added: test/command/suite/table_remove/pat/without_columns.test (+7 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/table_remove/pat/without_columns.test    2013-08-03 11:38:51 +0900 (d91a260)
@@ -0,0 +1,7 @@
+table_create Names TABLE_PAT_KEY ShortText
+
+dump
+
+table_remove Names
+
+dump
-------------- next part --------------
HTML����������������������������...
Download 



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