[Groonga-commit] groonga/groonga at 4410223 [master] Extract code that removes index column

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 3 15:58:31 JST 2013


Kouhei Sutou	2013-08-03 15:58:31 +0900 (Sat, 03 Aug 2013)

  New Revision: 4410223eaf84ccaa7c1244a41299cdef4ae334cc
  https://github.com/groonga/groonga/commit/4410223eaf84ccaa7c1244a41299cdef4ae334cc

  Message:
    Extract code that removes index column

  Added files:
    test/command/suite/column_remove/index.expected
    test/command/suite/column_remove/index.test
  Modified files:
    lib/db.c

  Modified: lib/db.c (+15 -8)
===================================================================
--- lib/db.c    2013-08-03 15:55:09 +0900 (06b684e)
+++ lib/db.c    2013-08-03 15:58:31 +0900 (d6d35aa)
@@ -6727,6 +6727,20 @@ _grn_obj_remove_ra(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
 }
 
 static void
+_grn_obj_remove_index(grn_ctx *ctx, grn_obj *obj, grn_obj *db, grn_id id,
+                      const char *path)
+{
+  delete_source_hook(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_ii_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;
@@ -6773,14 +6787,7 @@ _grn_obj_remove(grn_ctx *ctx, grn_obj *obj)
     _grn_obj_remove_ra(ctx, obj, db, id, path);
     break;
   case GRN_COLUMN_INDEX :
-    delete_source_hook(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_ii_remove(ctx, path);
-    }
-    grn_obj_touch(ctx, db, NULL);
+    _grn_obj_remove_index(ctx, obj, db, id, path);
     break;
   default :
     if (GRN_DB_OBJP(obj)) {

  Added: test/command/suite/column_remove/index.expected (+21 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/column_remove/index.expected    2013-08-03 15:58:31 +0900 (77f7f39)
@@ -0,0 +1,21 @@
+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]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name
+[[0,0.0,0.0],true]
+dump
+table_create Users TABLE_PAT_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name
+
+column_remove Terms users_name
+[[0,0.0,0.0],true]
+dump
+table_create Users TABLE_PAT_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
+

  Added: test/command/suite/column_remove/index.test (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/column_remove/index.test    2013-08-03 15:58:31 +0900 (063c2c4)
@@ -0,0 +1,13 @@
+table_create Users TABLE_PAT_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name
+
+dump
+
+column_remove Terms users_name
+
+dump
-------------- next part --------------
HTML����������������������������...
Download 



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