Class: Alf::Sql::Processor::Where
- Inherits:
-
Alf::Sql::Processor
- Object
- Sexpr::Rewriter
- Alf::Sql::Processor
- Alf::Sql::Processor::Where
- Defined in:
- lib/alf/sql/processor/where.rb
Constant Summary
Constants inherited from Alf::Sql::Processor
Instance Attribute Summary
Attributes inherited from Alf::Sql::Processor
Instance Method Summary collapse
-
#initialize(predicate, builder) ⇒ Where
constructor
A new instance of Where.
- #on_select_exp(sexpr) ⇒ Object
Methods inherited from Alf::Sql::Processor
#on_set_operator, #on_with_exp
Constructor Details
#initialize(predicate, builder) ⇒ Where
Returns a new instance of Where.
6 7 8 9 |
# File 'lib/alf/sql/processor/where.rb', line 6 def initialize(predicate, builder) super(builder) @predicate = predicate end |
Instance Method Details
#on_select_exp(sexpr) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/alf/sql/processor/where.rb', line 11 def on_select_exp(sexpr) pred = @predicate.rename(sexpr.desaliaser).sexpr if sexpr.where_clause anded = [:and, sexpr.where_clause.predicate, pred ] anded = Alf::Predicate::Grammar.sexpr(anded) sexpr.with_update(:where_clause, [ :where_clause, anded ]) else sexpr.with_insert(4, [ :where_clause, pred ]) end end |