[Groonga-commit] groonga/groonga at 149d05e [master] mrb: support cursor with min

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Feb 3 12:51:54 JST 2015


Kouhei Sutou	2015-02-03 12:51:54 +0900 (Tue, 03 Feb 2015)

  New Revision: 149d05e3f3eb3991de8f3344d95c1d2bffb7b4cc
  https://github.com/groonga/groonga/commit/149d05e3f3eb3991de8f3344d95c1d2bffb7b4cc

  Message:
    mrb: support cursor with min
    
    min must be string for now. It should be supported more types such as
    integer in the future.

  Modified files:
    lib/mrb/mrb_table_cursor.c

  Modified: lib/mrb/mrb_table_cursor.c (+18 -0)
===================================================================
--- lib/mrb/mrb_table_cursor.c    2015-02-03 12:51:39 +0900 (9407bb0)
+++ lib/mrb/mrb_table_cursor.c    2015-02-03 12:51:54 +0900 (4b9690d)
@@ -22,6 +22,7 @@
 #include <mruby.h>
 #include <mruby/class.h>
 #include <mruby/data.h>
+#include <mruby/string.h>
 #include <mruby/hash.h>
 
 #include "mrb_ctx.h"
@@ -52,8 +53,25 @@ mrb_grn_table_cursor_singleton_open(mrb_state *mrb, mrb_value klass)
 
   table = DATA_PTR(mrb_table);
   if (!mrb_nil_p(mrb_options)) {
+    mrb_value mrb_min;
     mrb_value mrb_flags;
 
+    mrb_min = mrb_hash_get(mrb, mrb_options,
+                           mrb_symbol_value(mrb_intern_lit(mrb, "min")));
+    if (!mrb_nil_p(mrb_min)) {
+      switch (mrb_type(mrb_min)) {
+      case MRB_TT_STRING :
+        min = RSTRING_PTR(mrb_min);
+        min_size = RSTRING_LEN(mrb_min);
+        break;
+      default :
+        mrb_raisef(mrb, E_NOTIMP_ERROR,
+                   "min: only string is supported for now: %s",
+                   mrb_min);
+        break;
+      }
+    }
+
     mrb_flags = mrb_hash_get(mrb, mrb_options,
                              mrb_symbol_value(mrb_intern_lit(mrb, "flags")));
     if (!mrb_nil_p(mrb_flags)) {
-------------- next part --------------
HTML����������������������������...
다운로드 



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