Class: Bmg::Sql::Processor
- Inherits:
-
Sexpr::Rewriter
- Object
- Sexpr::Rewriter
- Bmg::Sql::Processor
- Defined in:
- lib/bmg/sql/processor.rb,
lib/bmg/sql/processor/all.rb,
lib/bmg/sql/processor/bind.rb,
lib/bmg/sql/processor/clip.rb,
lib/bmg/sql/processor/join.rb,
lib/bmg/sql/processor/star.rb,
lib/bmg/sql/processor/merge.rb,
lib/bmg/sql/processor/where.rb,
lib/bmg/sql/processor/extend.rb,
lib/bmg/sql/processor/rename.rb,
lib/bmg/sql/processor/flatten.rb,
lib/bmg/sql/processor/reorder.rb,
lib/bmg/sql/processor/distinct.rb,
lib/bmg/sql/processor/order_by.rb,
lib/bmg/sql/processor/constants.rb,
lib/bmg/sql/processor/from_self.rb,
lib/bmg/sql/processor/requalify.rb,
lib/bmg/sql/processor/semi_join.rb,
lib/bmg/sql/processor/summarize.rb,
lib/bmg/sql/processor/transform.rb,
lib/bmg/sql/processor/join_support.rb,
lib/bmg/sql/processor/limit_offset.rb
Direct Known Subclasses
All, Bind, Clip, Constants, Distinct, Extend, Flatten, FromSelf, Join, LimitOffset, Merge, OrderBy, Rename, Reorder, Requalify, SemiJoin, Star, Summarize, Transform, Where
Defined Under Namespace
Modules: JoinSupport Classes: All, Bind, Clip, Constants, Distinct, Extend, Flatten, FromSelf, Join, LimitOffset, Merge, OrderBy, Rename, Reorder, Requalify, SemiJoin, Star, Summarize, Transform, Where
Constant Summary collapse
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
Instance Method Summary collapse
-
#initialize(builder) ⇒ Processor
constructor
A new instance of Processor.
- #on_select_exp(sexpr) ⇒ Object
- #on_set_operator(sexpr) ⇒ Object (also: #on_union, #on_except, #on_intersect)
- #on_with_exp(sexpr) ⇒ Object
Constructor Details
#initialize(builder) ⇒ Processor
Returns a new instance of Processor.
8 9 10 |
# File 'lib/bmg/sql/processor.rb', line 8 def initialize(builder) @builder = builder end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
11 12 13 |
# File 'lib/bmg/sql/processor.rb', line 11 def builder @builder end |
Instance Method Details
#on_select_exp(sexpr) ⇒ Object
31 32 33 |
# File 'lib/bmg/sql/processor.rb', line 31 def on_select_exp(sexpr) sexpr.with_update(2, apply(sexpr[2])) end |
#on_set_operator(sexpr) ⇒ Object Also known as: on_union, on_except, on_intersect
22 23 24 25 26 |
# File 'lib/bmg/sql/processor.rb', line 22 def on_set_operator(sexpr) sexpr.each_with_index.map{|child,index| index <= 1 ? child : apply(child) } end |
#on_with_exp(sexpr) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/bmg/sql/processor.rb', line 13 def on_with_exp(sexpr) applied = apply(sexpr.select_exp) if applied.with_exp? merge_with_exps(sexpr, applied, applied.select_exp) else sexpr.with_update(-1, applied) end end |