aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/visitors/oracle.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-24 09:41:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-24 09:41:48 -0700
commit487df1771ded1fb065a53ebe9d1a5a9c119478e3 (patch)
treedacefa00fca782bcbd86bd5cf2476226253fc674 /lib/arel/visitors/oracle.rb
parent7615bd7f928390d0ba9501e5206fd89ce6ce44fc (diff)
downloadrails-487df1771ded1fb065a53ebe9d1a5a9c119478e3.tar.gz
rails-487df1771ded1fb065a53ebe9d1a5a9c119478e3.tar.bz2
rails-487df1771ded1fb065a53ebe9d1a5a9c119478e3.zip
adding an oracle visitor
Diffstat (limited to 'lib/arel/visitors/oracle.rb')
-rw-r--r--lib/arel/visitors/oracle.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb
new file mode 100644
index 0000000000..840a7a9ace
--- /dev/null
+++ b/lib/arel/visitors/oracle.rb
@@ -0,0 +1,15 @@
+module Arel
+ module Visitors
+ class Oracle < Arel::Visitors::ToSql
+ def visit_Arel_Nodes_SelectStatement o
+ if o.limit
+ o.cores.last.wheres.push Nodes::LessThanOrEqual.new(
+ Nodes::SqlLiteral.new('ROWNUM'), o.limit
+ )
+ o.limit = nil
+ end
+ super
+ end
+ end
+ end
+end