[Groonga-commit] groonga/groonga at 4abacde [master] mrb: grn_bulk -> mrb_value converts record to Record not ID

Back to archive index

Kouhei Sutou null+****@clear*****
Tue May 22 15:32:47 JST 2018


Kouhei Sutou	2018-05-22 15:32:47 +0900 (Tue, 22 May 2018)

  New Revision: 4abacdef708e463890461a93c81738433c7c1499
  https://github.com/groonga/groonga/commit/4abacdef708e463890461a93c81738433c7c1499

  Message:
    mrb: grn_bulk -> mrb_value converts record to Record not ID

  Modified files:
    lib/mrb/mrb_bulk.c

  Modified: lib/mrb/mrb_bulk.c (+13 -3)
===================================================================
--- lib/mrb/mrb_bulk.c    2018-05-22 15:32:26 +0900 (c40f367c7)
+++ lib/mrb/mrb_bulk.c    2018-05-22 15:32:47 +0900 (e747decd0)
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 2 -*- */
 /*
-  Copyright(C) 2014-2016 Brazil
+  Copyright(C) 2014-2018 Brazil
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -29,6 +29,7 @@
 
 #include "../grn_db.h"
 #include "mrb_bulk.h"
+#include "mrb_converter.h"
 #include "mrb_object.h"
 
 static struct mrb_data_type mrb_grn_bulk_type = {
@@ -245,8 +246,17 @@ grn_mrb_value_from_bulk(mrb_state *mrb, grn_obj *bulk)
       }
 
       if (is_record) {
-        mrb_value_ = mrb_fixnum_value(GRN_RECORD_VALUE(bulk));
-        grn_obj_unlink(ctx, domain);
+        grn_mrb_data *data = &(ctx->impl->mrb);
+        struct RClass *mrb_record_class;
+        mrb_value mrb_new_arguments[2];
+
+        mrb_record_class = mrb_class_get_under(mrb, data->module, "Record");
+        mrb_new_arguments[0] = grn_mrb_value_from_grn_obj(mrb, domain);
+        mrb_new_arguments[1] = mrb_fixnum_value(GRN_RECORD_VALUE(bulk));
+        mrb_value_ = mrb_obj_new(mrb,
+                                 mrb_record_class,
+                                 2,
+                                 mrb_new_arguments);
       } else {
 #define MESSAGE_SIZE 4096
         char message[MESSAGE_SIZE];
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180522/b3c64426/attachment-0001.htm 



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