Class: Bmg::Sql::Processor::Requalify
- Inherits:
-
Bmg::Sql::Processor
- Object
- Sexpr::Rewriter
- Bmg::Sql::Processor
- Bmg::Sql::Processor::Requalify
- Defined in:
- lib/bmg/sql/processor/requalify.rb
Constant Summary
Constants inherited from Bmg::Sql::Processor
Instance Attribute Summary collapse
-
#requalify ⇒ Object
readonly
Returns the value of attribute requalify.
Attributes inherited from Bmg::Sql::Processor
Instance Method Summary collapse
-
#initialize(builder) ⇒ Requalify
constructor
A new instance of Requalify.
- #on_qualified_identifier(sexpr) ⇒ Object
- #on_range_var_name(sexpr) ⇒ Object
- #on_where_clause(sexpr) ⇒ Object
Methods inherited from Bmg::Sql::Processor
#on_set_operator, #on_with_exp
Constructor Details
#initialize(builder) ⇒ Requalify
Returns a new instance of Requalify.
6 7 8 9 10 11 |
# File 'lib/bmg/sql/processor/requalify.rb', line 6 def initialize(builder) super @requalify = Hash.new{|h,k| h[k.to_s] = builder.next_qualifier! } end |
Instance Attribute Details
#requalify ⇒ Object (readonly)
Returns the value of attribute requalify.
12 13 14 |
# File 'lib/bmg/sql/processor/requalify.rb', line 12 def requalify @requalify end |
Instance Method Details
#on_qualified_identifier(sexpr) ⇒ Object
26 27 28 |
# File 'lib/bmg/sql/processor/requalify.rb', line 26 def on_qualified_identifier(sexpr) Predicate::Factory.qualified_identifier(requalify[sexpr.qualifier.to_s].to_sym, sexpr.name.to_sym) end |
#on_range_var_name(sexpr) ⇒ Object
17 18 19 |
# File 'lib/bmg/sql/processor/requalify.rb', line 17 def on_range_var_name(sexpr) Grammar.sexpr [:range_var_name, requalify[sexpr.qualifier.to_s] ] end |
#on_where_clause(sexpr) ⇒ Object
21 22 23 24 |
# File 'lib/bmg/sql/processor/requalify.rb', line 21 def on_where_clause(sexpr) pred = Predicate::Grammar.sexpr(apply(sexpr.predicate)) sexpr([:where_clause, pred]) end |