Class: Bmg::Sql::Processor::Flatten
- Inherits:
-
Bmg::Sql::Processor
- Object
- Sexpr::Rewriter
- Bmg::Sql::Processor
- Bmg::Sql::Processor::Flatten
- Defined in:
- lib/bmg/sql/processor/flatten.rb
Constant Summary
Constants inherited from Bmg::Sql::Processor
Instance Attribute Summary collapse
-
#subqueries ⇒ Object
readonly
Returns the value of attribute subqueries.
Attributes inherited from Bmg::Sql::Processor
Instance Method Summary collapse
Methods inherited from Bmg::Sql::Processor
Constructor Details
This class inherits a constructor from Bmg::Sql::Processor
Instance Attribute Details
#subqueries ⇒ Object (readonly)
Returns the value of attribute subqueries.
10 11 12 |
# File 'lib/bmg/sql/processor/flatten.rb', line 10 def subqueries @subqueries end |
Instance Method Details
#on_table_as(sexpr) ⇒ Object
15 16 17 18 19 |
# File 'lib/bmg/sql/processor/flatten.rb', line 15 def on_table_as(sexpr) return sexpr unless subqueries return sexpr unless subquery = subqueries[sexpr.table_name] [ :subquery_as, apply(subquery), sexpr.right ] end |
#on_with_exp(sexpr) ⇒ Object
6 7 8 9 |
# File 'lib/bmg/sql/processor/flatten.rb', line 6 def on_with_exp(sexpr) @subqueries = sexpr.with_spec.to_hash apply(sexpr.select_exp) end |