Class: Bmg::Sql::Processor::Bind

Inherits:
Bmg::Sql::Processor show all
Defined in:
lib/bmg/sql/processor/bind.rb

Constant Summary

Constants inherited from Bmg::Sql::Processor

UnexpectedError

Instance Attribute Summary

Attributes inherited from Bmg::Sql::Processor

#builder

Instance Method Summary collapse

Methods inherited from Bmg::Sql::Processor

#on_set_operator, #on_with_exp

Constructor Details

#initialize(binding, builder) ⇒ Bind

Returns a new instance of Bind.



6
7
8
9
# File 'lib/bmg/sql/processor/bind.rb', line 6

def initialize(binding, builder)
  super(builder)
  @binding = binding
end

Instance Method Details

#on_select_exp(sexpr) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/bmg/sql/processor/bind.rb', line 11

def on_select_exp(sexpr)
  if w = sexpr.where_clause
    pred = Predicate::Grammar.sexpr(w.predicate.bind(@binding))
    sexpr.with_update(:where_clause, [ :where_clause, pred ])
  else
    sexpr
  end
end