[Groonga-commit] groonga/groonga at fbe77b2 [master] Support casting a record to the same table's record

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Jan 15 17:08:08 JST 2016


Kouhei Sutou	2016-01-15 17:08:08 +0900 (Fri, 15 Jan 2016)

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

  Message:
    Support casting a record to the same table's record

  Modified files:
    lib/db.c

  Modified: lib/db.c (+21 -1)
===================================================================
--- lib/db.c    2016-01-15 15:16:30 +0900 (d4779e8)
+++ lib/db.c    2016-01-15 17:08:08 +0900 (5d089b8)
@@ -6139,7 +6139,27 @@ grn_obj_cast(grn_ctx *ctx, grn_obj *src, grn_obj *dest,
     rc = grn_obj_reinit(ctx, dest, dest->header.domain, dest->header.flags);
     break;
   default :
-    rc = GRN_FUNCTION_NOT_IMPLEMENTED;
+    if (src->header.domain >= GRN_N_RESERVED_TYPES) {
+      grn_obj *table;
+      table = grn_ctx_at(ctx, src->header.domain);
+      switch (table->header.type) {
+      case GRN_TABLE_HASH_KEY :
+      case GRN_TABLE_PAT_KEY :
+      case GRN_TABLE_DAT_KEY :
+      case GRN_TABLE_NO_KEY :
+        if (src->header.domain == dest->header.domain) {
+          GRN_RECORD_SET(ctx, dest, GRN_RECORD_VALUE(src));
+        } else {
+          rc = GRN_FUNCTION_NOT_IMPLEMENTED;
+        }
+        break;
+      default :
+        rc = GRN_FUNCTION_NOT_IMPLEMENTED;
+        break;
+      }
+    } else {
+      rc = GRN_FUNCTION_NOT_IMPLEMENTED;
+    }
     break;
   }
   return rc;
-------------- next part --------------
HTML����������������������������...
Download 



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