[Groonga-commit] groonga/groonga [master] modified grn_dat_cursor to support GRN_CURSOR_BY_KEY.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 7月 4日 (月) 21:19:07 JST


Susumu Yata	2011-07-04 12:19:07 +0000 (Mon, 04 Jul 2011)

  New Revision: 821e659624ab3fd5ba50c0deb20a9e45c4df957d

  Log:
    modified grn_dat_cursor to support GRN_CURSOR_BY_KEY.

  Modified files:
    lib/dat.cpp

  Modified: lib/dat.cpp (+8 -3)
===================================================================
--- lib/dat.cpp    2011-07-04 12:13:11 +0000 (f8cca8f)
+++ lib/dat.cpp    2011-07-04 12:19:07 +0000 (ea186e9)
@@ -334,9 +334,14 @@ grn_dat_cursor_open(grn_ctx *ctx, grn_dat *dat,
           }
         }
       } else {
-        // Cursor is now an abstract type;
-        // dc->cursor = new grn::dat::Cursor;
-        /* todo */
+        grn::dat::Trie *trie = static_cast<grn::dat::Trie *>(dat->handle);
+        grn::dat::Cursor *cursor = grn::dat::CursorFactory::open(*trie,
+            min, min_size, max, max_size, offset, limit,
+            grn::dat::KEY_RANGE_CURSOR |
+            ((flags & GRN_CURSOR_DESCENDING) ? grn::dat::DESCENDING_CURSOR : 0) |
+            ((flags & GRN_CURSOR_GT) ? grn::dat::EXCEPT_LOWER_BOUND : 0) |
+            ((flags & GRN_CURSOR_LT) ? grn::dat::EXCEPT_UPPER_BOUND : 0));
+        dc->cursor = cursor;
       }
     }
 //    if (flags & GRN_CURSOR_DESCENDING) {




Groonga-commit メーリングリストの案内
Back to archive index