diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-14 20:53:19 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-14 20:53:19 -0800 |
commit | d4bfaf2b82934e8611824c15cbf855d3d02418b5 (patch) | |
tree | 39a6df65cf143a60b53aa806c6e5b5db5b072cca /lib/arel | |
parent | ef46276acda7db7b33ee8b84a39cd7d10c3e2628 (diff) | |
download | rails-d4bfaf2b82934e8611824c15cbf855d3d02418b5.tar.gz rails-d4bfaf2b82934e8611824c15cbf855d3d02418b5.tar.bz2 rails-d4bfaf2b82934e8611824c15cbf855d3d02418b5.zip |
cleaning up more nodes
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/nodes.rb | 10 | ||||
-rw-r--r-- | lib/arel/nodes/group.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/grouping.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/having.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/not.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/offset.rb | 7 | ||||
-rw-r--r-- | lib/arel/nodes/on.rb | 6 | ||||
-rw-r--r-- | lib/arel/nodes/unary.rb | 12 | ||||
-rw-r--r-- | lib/arel/visitors/oracle.rb | 4 |
9 files changed, 17 insertions, 46 deletions
diff --git a/lib/arel/nodes.rb b/lib/arel/nodes.rb index 83977c356a..9af6ad9ce3 100644 --- a/lib/arel/nodes.rb +++ b/lib/arel/nodes.rb @@ -1,5 +1,8 @@ require 'arel/nodes/node' + require 'arel/nodes/unary' +require 'arel/nodes/unqualified_column' + require 'arel/nodes/binary' require 'arel/nodes/equality' @@ -7,31 +10,24 @@ require 'arel/nodes/and' require 'arel/nodes/in' require 'arel/nodes/lock' -require 'arel/nodes/not' require 'arel/nodes/join_source' require 'arel/nodes/ordering' require 'arel/nodes/function' require 'arel/nodes/count' require 'arel/nodes/values' -require 'arel/nodes/offset' require 'arel/nodes/sum' require 'arel/nodes/exists' require 'arel/nodes/max' require 'arel/nodes/min' require 'arel/nodes/avg' -require 'arel/nodes/having' 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/unqualified_column' require 'arel/nodes/table_alias' -require 'arel/nodes/group' -require 'arel/nodes/grouping' require 'arel/nodes/inner_join' require 'arel/nodes/outer_join' require 'arel/nodes/string_join' -require 'arel/nodes/on' diff --git a/lib/arel/nodes/group.rb b/lib/arel/nodes/group.rb deleted file mode 100644 index a7fa6f170d..0000000000 --- a/lib/arel/nodes/group.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Group < Arel::Nodes::Unary - end - end -end diff --git a/lib/arel/nodes/grouping.rb b/lib/arel/nodes/grouping.rb deleted file mode 100644 index 18adeae97f..0000000000 --- a/lib/arel/nodes/grouping.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Grouping < Arel::Nodes::Unary - end - end -end diff --git a/lib/arel/nodes/having.rb b/lib/arel/nodes/having.rb deleted file mode 100644 index 6972c58dda..0000000000 --- a/lib/arel/nodes/having.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Having < Arel::Nodes::Unary - end - end -end diff --git a/lib/arel/nodes/not.rb b/lib/arel/nodes/not.rb deleted file mode 100644 index de138435bb..0000000000 --- a/lib/arel/nodes/not.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class Not < Arel::Nodes::Unary - end - end -end diff --git a/lib/arel/nodes/offset.rb b/lib/arel/nodes/offset.rb deleted file mode 100644 index d93e46aa1f..0000000000 --- a/lib/arel/nodes/offset.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Arel - module Nodes - class Offset < Arel::Nodes::Unary - alias :value :expr - end - end -end diff --git a/lib/arel/nodes/on.rb b/lib/arel/nodes/on.rb deleted file mode 100644 index 953d64f9f1..0000000000 --- a/lib/arel/nodes/on.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Arel - module Nodes - class On < Arel::Nodes::Unary - end - end -end diff --git a/lib/arel/nodes/unary.rb b/lib/arel/nodes/unary.rb index edda89e1f0..f679017597 100644 --- a/lib/arel/nodes/unary.rb +++ b/lib/arel/nodes/unary.rb @@ -2,10 +2,22 @@ module Arel module Nodes class Unary < Arel::Nodes::Node attr_accessor :expr + alias :value :expr def initialize expr @expr = expr end end + + %w{ + Not + Group + Grouping + Offset + Having + On + }.each do |name| + const_set(name, Class.new(Unary)) + end end end diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index ecb157f8bc..63dfc6788c 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -27,7 +27,7 @@ module Arel SELECT * FROM ( SELECT raw_sql_.*, rownum raw_rnum_ FROM (#{sql}) raw_sql_ - WHERE rownum <= #{offset.value.to_i + limit} + WHERE rownum <= #{offset.expr.to_i + limit} ) WHERE #{visit offset} eosql @@ -58,7 +58,7 @@ module Arel end def visit_Arel_Nodes_Offset o - "raw_rnum_ > #{visit o.value}" + "raw_rnum_ > #{visit o.expr}" end ### |