From 4acbe3864f5e5c4c8c70c5f58fbd5c09617d1662 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 3 Jan 2011 12:20:13 -0800 Subject: fisting lots of oracle errors --- lib/arel/visitors/oracle.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index ecb157f8bc..fa943b2904 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -10,7 +10,7 @@ module Arel # then can use simple ROWNUM in WHERE clause if o.limit && o.orders.empty? && !o.offset && o.cores.first.projections.first !~ /^DISTINCT / o.cores.last.wheres.push Nodes::LessThanOrEqual.new( - Nodes::SqlLiteral.new('ROWNUM'), o.limit + Nodes::SqlLiteral.new('ROWNUM'), o.limit.expr ) o.limit = nil return super @@ -18,7 +18,7 @@ module Arel if o.limit && o.offset o = o.dup - limit = o.limit.to_i + limit = o.limit.expr.to_i offset = o.offset o.limit = nil o.offset = nil @@ -35,9 +35,9 @@ module Arel if o.limit o = o.dup - limit = o.limit + limit = o.limit.expr o.limit = nil - return "SELECT * FROM (#{super(o)}) WHERE ROWNUM <= #{limit}" + return "SELECT * FROM (#{super(o)}) WHERE ROWNUM <= #{visit limit}" end if o.offset -- cgit v1.2.3