mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
cleaning up more nodes
This commit is contained in:
parent
d4bfaf2b82
commit
494a965429
10 changed files with 47 additions and 62 deletions
|
@ -18,20 +18,16 @@ lib/arel/factory_methods.rb
|
|||
lib/arel/insert_manager.rb
|
||||
lib/arel/nodes.rb
|
||||
lib/arel/nodes/and.rb
|
||||
lib/arel/nodes/avg.rb
|
||||
lib/arel/nodes/binary.rb
|
||||
lib/arel/nodes/count.rb
|
||||
lib/arel/nodes/delete_statement.rb
|
||||
lib/arel/nodes/equality.rb
|
||||
lib/arel/nodes/exists.rb
|
||||
lib/arel/nodes/function.rb
|
||||
lib/arel/nodes/in.rb
|
||||
lib/arel/nodes/inner_join.rb
|
||||
lib/arel/nodes/insert_statement.rb
|
||||
lib/arel/nodes/join_source.rb
|
||||
lib/arel/nodes/lock.rb
|
||||
lib/arel/nodes/max.rb
|
||||
lib/arel/nodes/min.rb
|
||||
lib/arel/nodes/node.rb
|
||||
lib/arel/nodes/ordering.rb
|
||||
lib/arel/nodes/outer_join.rb
|
||||
|
@ -39,7 +35,6 @@ lib/arel/nodes/select_core.rb
|
|||
lib/arel/nodes/select_statement.rb
|
||||
lib/arel/nodes/sql_literal.rb
|
||||
lib/arel/nodes/string_join.rb
|
||||
lib/arel/nodes/sum.rb
|
||||
lib/arel/nodes/table_alias.rb
|
||||
lib/arel/nodes/unary.rb
|
||||
lib/arel/nodes/unqualified_column.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'
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
module Arel
|
||||
module Nodes
|
||||
class Avg < Arel::Nodes::Function
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
module Arel
|
||||
module Nodes
|
||||
class Exists < Arel::Nodes::Function
|
||||
alias :select_stmt :expressions
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
module Arel
|
||||
module Nodes
|
||||
class Max < Arel::Nodes::Function
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
module Arel
|
||||
module Nodes
|
||||
class Min < Arel::Nodes::Function
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
module Arel
|
||||
module Nodes
|
||||
class Sum < Arel::Nodes::Function
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue