[Groonga-commit] groonga/groonga at f1bb9c2 [master] Detect arithmetic operator against relation expression result

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Nov 3 19:24:33 JST 2014


Kouhei Sutou	2014-11-03 19:24:33 +0900 (Mon, 03 Nov 2014)

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

  Message:
    Detect arithmetic operator against relation expression result
    
    If it's detected, the expression is an invalid expression. This is the
    same behavior as before supporting arithmetic operator with index search.

  Modified files:
    lib/expr.c
    lib/mrb/scripts/scan_info_builder.rb

  Modified: lib/expr.c (+1 -0)
===================================================================
--- lib/expr.c    2014-11-03 18:40:45 +0900 (65c033b)
+++ lib/expr.c    2014-11-03 19:24:33 +0900 (c6ca6cd)
@@ -4450,6 +4450,7 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
     case GRN_OP_MOD :
       if (stat < SCAN_COL1 || SCAN_CONST < stat) { return NULL; }
       stat = SCAN_START;
+      if (m != o + 1) { return NULL; }
       break;
     case GRN_OP_AND :
     case GRN_OP_OR :

  Modified: lib/mrb/scripts/scan_info_builder.rb (+1 -0)
===================================================================
--- lib/mrb/scripts/scan_info_builder.rb    2014-11-03 18:40:45 +0900 (48f5349)
+++ lib/mrb/scripts/scan_info_builder.rb    2014-11-03 19:24:33 +0900 (af4477e)
@@ -158,6 +158,7 @@ module Groonga
           return false if status < Status::COL1
           return false if status > Status::CONST
           status = Status::START
+          return false if n_relation_expressions != (n_logical_expressions + 1)
         when *LOGICAL_OPERATORS
           return false if status != Status::START
           n_logical_expressions += 1
-------------- next part --------------
HTML����������������������������...
下載 



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