[Groonga-mysql-commit] mroonga/mroonga at 0bfbe2c [master] Support VARCHAR equal in WHERE for ORDER BY LIMIT optimization

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Aug 16 23:44:57 JST 2013


Kouhei Sutou	2013-08-16 23:44:57 +0900 (Fri, 16 Aug 2013)

  New Revision: 0bfbe2ccdd77f333277cae09c9113e5ade649c84
  https://github.com/mroonga/mroonga/commit/0bfbe2ccdd77f333277cae09c9113e5ade649c84

  Message:
    Support VARCHAR equal in WHERE for ORDER BY LIMIT optimization

  Modified files:
    lib/mrn_condition.cpp
    lib/mrn_condition_converter.cpp

  Modified: lib/mrn_condition.cpp (+2 -1)
===================================================================
--- lib/mrn_condition.cpp    2013-08-16 23:36:56 +0900 (ae637b9)
+++ lib/mrn_condition.cpp    2013-08-16 23:44:57 +0900 (39d4a7f)
@@ -67,7 +67,8 @@ namespace mrn {
             Item *right_item = arguments[1];
             if (left_item->type() == Item::FIELD_ITEM &&
                 right_item->basic_const_item() &&
-                right_item->type() == Item::INT_ITEM) {
+                (right_item->type() == Item::STRING_ITEM ||
+                 right_item->type() == Item::INT_ITEM)) {
               convertable = true;
             }
           }

  Modified: lib/mrn_condition_converter.cpp (+8 -0)
===================================================================
--- lib/mrn_condition_converter.cpp    2013-08-16 23:36:56 +0900 (6338730)
+++ lib/mrn_condition_converter.cpp    2013-08-16 23:44:57 +0900 (4ba5653)
@@ -108,6 +108,14 @@ namespace mrn {
     MRN_DBUG_ENTER_METHOD();
 
     switch (const_item->type()) {
+    case Item::STRING_ITEM:
+      grn_obj_reinit(ctx_, &value_, GRN_DB_TEXT, 0);
+      {
+        String *string;
+        string = const_item->val_str(NULL);
+        GRN_TEXT_SET(ctx_, &value_, string->ptr(), string->length());
+      }
+      break;
     case Item::INT_ITEM:
       grn_obj_reinit(ctx_, &value_, GRN_DB_INT64, 0);
       GRN_INT64_SET(ctx_, &value_, const_item->val_int());
-------------- next part --------------
HTML����������������������������...
Download 



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