diff options
author | Paul Sadauskas <psadauskas@gmail.com> | 2011-01-20 12:56:08 -0700 |
---|---|---|
committer | Paul Sadauskas <psadauskas@gmail.com> | 2011-01-21 17:25:12 -0700 |
commit | d532b7ee430c5d0c412ab9f1a5e0dd3ebc47f86b (patch) | |
tree | b6cd36d2643c2437db9778a250ce622e8b3432e0 /lib/arel/nodes | |
parent | dae7a245f8ec9f8eb5d9866938ea46ed7c88dcf1 (diff) | |
download | rails-d532b7ee430c5d0c412ab9f1a5e0dd3ebc47f86b.tar.gz rails-d532b7ee430c5d0c412ab9f1a5e0dd3ebc47f86b.tar.bz2 rails-d532b7ee430c5d0c412ab9f1a5e0dd3ebc47f86b.zip |
Add support for WITH and UNION
PostgreSQL WITH RECURSIVE support
Make WITH be a unary node
Diffstat (limited to 'lib/arel/nodes')
-rw-r--r-- | lib/arel/nodes/binary.rb | 2 | ||||
-rw-r--r-- | lib/arel/nodes/select_statement.rb | 14 | ||||
-rw-r--r-- | lib/arel/nodes/with.rb | 17 |
3 files changed, 27 insertions, 6 deletions
diff --git a/lib/arel/nodes/binary.rb b/lib/arel/nodes/binary.rb index 0d02554199..e72228f11c 100644 --- a/lib/arel/nodes/binary.rb +++ b/lib/arel/nodes/binary.rb @@ -29,6 +29,8 @@ module Arel NotEqual NotIn Or + Union + UnionAll }.each do |name| const_set name, Class.new(Binary) end diff --git a/lib/arel/nodes/select_statement.rb b/lib/arel/nodes/select_statement.rb index c9a0cde4e0..cd74dd8e28 100644 --- a/lib/arel/nodes/select_statement.rb +++ b/lib/arel/nodes/select_statement.rb @@ -2,15 +2,17 @@ module Arel module Nodes class SelectStatement < Arel::Nodes::Node attr_reader :cores - attr_accessor :limit, :orders, :lock, :offset + attr_accessor :limit, :orders, :lock, :offset, :with, :with_recursive def initialize cores = [SelectCore.new] #puts caller - @cores = cores - @orders = [] - @limit = nil - @lock = nil - @offset = nil + @cores = cores + @orders = [] + @limit = nil + @lock = nil + @offset = nil + @with = nil + @with_recursive = nil end def initialize_copy other diff --git a/lib/arel/nodes/with.rb b/lib/arel/nodes/with.rb new file mode 100644 index 0000000000..ce1644b60e --- /dev/null +++ b/lib/arel/nodes/with.rb @@ -0,0 +1,17 @@ +module Arel + module Nodes + class With < Arel::Nodes::Unary + attr_reader :children + alias value children + alias expr children + + def initialize *children + @children = children + end + + end + + class WithRecursive < With; end + end +end + |