Navigation Menu

Skip to content

Commit

Permalink
Revert "Add backward compatibility code for Groonga 7.0.2"
Browse files Browse the repository at this point in the history
This reverts commit e8aedd0.

Because Groonga 7.0.2 reverted OP_CALL nargs incompatibility.
  • Loading branch information
kou committed Apr 25, 2017
1 parent e8aedd0 commit 95a12fb
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions lib/groonga/expression-builder.rb
@@ -1,5 +1,5 @@
# Copyright (C) 2015 Masafumi Yokoyama <yokoyama@clear-code.com>
# Copyright (C) 2009-2017 Kouhei Sutou <kou@clear-code.com>
# Copyright (C) 2009-2016 Kouhei Sutou <kou@clear-code.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand All @@ -15,25 +15,8 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

module Groonga
# @private
module CallOperationAppendable
private
def append_call_operation(expression, n_arguments)
# TODO: Remove me when we require Groonga 7.0.2 or later.
if (VERSION[0, 3] <=> [7, 0, 2]) > 0 or
(VERSION[0, 3] == [7, 0, 1] and
(VERSION[3] || "0").split("-")[0].to_i >= 105)
expression.append_operation(Operation::CALL, 1 + n_arguments)
else
expression.append_operation(Operation::CALL, n_arguments)
end
end
end

# @private
module ExpressionBuildable
include CallOperationAppendable

attr_reader :table
attr_accessor :query
attr_accessor :syntax
Expand Down Expand Up @@ -98,7 +81,7 @@ def build_expression(expression, variable)

if builders.empty?
expression.append_object(@table.context["all_records"])
append_call_operation(expression, 0)
expression.append_operation(Operation::CALL, 0)
else
combined_builder = builders.inject do |previous, builder|
previous & builder
Expand Down Expand Up @@ -505,8 +488,6 @@ def initialize(column_value_builder, value)

# @private
class CallExpressionBuilder < ExpressionBuilder
include CallOperationAppendable

def initialize(function, *arguments)
super()
@function = function
Expand All @@ -525,7 +506,7 @@ def build(expression, variable)
argument.build(expression, variable)
end
end
append_call_operation(expression, @arguments.size)
expression.append_operation(Operation::CALL, @arguments.size)
end
end
end
Expand Down

0 comments on commit 95a12fb

Please sign in to comment.