diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/nodes.rb | 40 | ||||
-rw-r--r-- | lib/arel/nodes/avg.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/binary.rb | 21 | ||||
-rw-r--r-- | lib/arel/nodes/exists.rb | 7 | ||||
-rw-r--r-- | lib/arel/nodes/function.rb | 10 | ||||
-rw-r--r-- | lib/arel/nodes/max.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/min.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/sum.rb | 6 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 2 |
9 files changed, 47 insertions, 57 deletions
diff --git a/lib/arel/nodes.rb b/lib/arel/nodes.rb index 9af6ad9ce3..c43134bb50 100644 --- a/lib/arel/nodes.rb +++ b/lib/arel/nodes.rb @@ -1,33 +1,37 @@ +# node require 'arel/nodes/node' +require 'arel/nodes/lock' +require 'arel/nodes/select_statement' +require 'arel/nodes/select_core' +require 'arel/nodes/insert_statement' +require 'arel/nodes/update_statement' +# unary require 'arel/nodes/unary' require 'arel/nodes/unqualified_column' +# binary require 'arel/nodes/binary' - require 'arel/nodes/equality' -require 'arel/nodes/and' -require 'arel/nodes/in' -require 'arel/nodes/lock' - +require 'arel/nodes/in' # Why is this subclassed from equality? require 'arel/nodes/join_source' - require 'arel/nodes/ordering' +require 'arel/nodes/delete_statement' +require 'arel/nodes/table_alias' + +# nary +require 'arel/nodes/and' + +# function +# FIXME: Function + Alias can be rewritten as a Function and Alias node. +# We should make Function a Unary node and deprecate the use of "aliaz" require 'arel/nodes/function' require 'arel/nodes/count' require 'arel/nodes/values' -require 'arel/nodes/sum' -require 'arel/nodes/exists' -require 'arel/nodes/max' -require 'arel/nodes/min' -require 'arel/nodes/avg' -require 'arel/nodes/sql_literal' -require 'arel/nodes/select_core' -require 'arel/nodes/select_statement' -require 'arel/nodes/insert_statement' -require 'arel/nodes/update_statement' -require 'arel/nodes/delete_statement' -require 'arel/nodes/table_alias' + +# joins require 'arel/nodes/inner_join' require 'arel/nodes/outer_join' require 'arel/nodes/string_join' + +require 'arel/nodes/sql_literal' diff --git a/lib/arel/nodes/avg.rb b/lib/arel/nodes/avg.rb deleted file mode 100644 index 8fc86fc21e..0000000000 --- a/lib/arel/nodes/avg.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Avg < Arel::Nodes::Function - end - end -end diff --git a/lib/arel/nodes/binary.rb b/lib/arel/nodes/binary.rb index 1285af9447..eb873c75e1 100644 --- a/lib/arel/nodes/binary.rb +++ b/lib/arel/nodes/binary.rb @@ -16,21 +16,28 @@ module Arel end %w{ - Between - NotEqual - Assignment - Or As + Assignment + Between + DoesNotMatch GreaterThan GreaterThanOrEqual + Join LessThan LessThanOrEqual Matches - DoesNotMatch + NotEqual NotIn - Join + Or }.each do |name| - const_set(name, Class.new(Binary)) + const_set name, Class.new(Binary) end + + #%w{ + # InnerJoin + # OuterJoin + #}.each do |name| + # Nodes.const_set name, Class.new(Join) + #end end end diff --git a/lib/arel/nodes/exists.rb b/lib/arel/nodes/exists.rb deleted file mode 100644 index 18ba8403b4..0000000000 --- a/lib/arel/nodes/exists.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Arel - module Nodes - class Exists < Arel::Nodes::Function - alias :select_stmt :expressions - end - end -end diff --git a/lib/arel/nodes/function.rb b/lib/arel/nodes/function.rb index 133dd66019..e4e45bff31 100644 --- a/lib/arel/nodes/function.rb +++ b/lib/arel/nodes/function.rb @@ -14,5 +14,15 @@ module Arel self end end + + %w{ + Sum + Exists + Max + Min + Avg + }.each do |name| + const_set(name, Class.new(Function)) + end end end diff --git a/lib/arel/nodes/max.rb b/lib/arel/nodes/max.rb deleted file mode 100644 index 5af611b0d6..0000000000 --- a/lib/arel/nodes/max.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Max < Arel::Nodes::Function - end - end -end diff --git a/lib/arel/nodes/min.rb b/lib/arel/nodes/min.rb deleted file mode 100644 index bdc1371858..0000000000 --- a/lib/arel/nodes/min.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Min < Arel::Nodes::Function - end - end -end diff --git a/lib/arel/nodes/sum.rb b/lib/arel/nodes/sum.rb deleted file mode 100644 index 3e043b7330..0000000000 --- a/lib/arel/nodes/sum.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Sum < Arel::Nodes::Function - end - end -end diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb index 8ceb839a6b..5efcbf009d 100644 --- a/lib/arel/visitors/to_sql.rb +++ b/lib/arel/visitors/to_sql.rb @@ -70,7 +70,7 @@ module Arel end def visit_Arel_Nodes_Exists o - "EXISTS (#{visit o.select_stmt})#{ + "EXISTS (#{visit o.expressions})#{ o.alias ? " AS #{visit o.alias}" : ''}" end |