From 78977c9c5fa6edd7eaa46cf8ff380b4e25825d5d Mon Sep 17 00:00:00 2001 From: tom Date: Tue, 8 Jan 2013 09:30:35 -0500 Subject: [PATCH] Add oracle paging optimization discussed in issue 99 --- lib/arel/visitors/oracle.rb | 2 +- test/visitors/test_oracle.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index 1441a20dbc..6a58a3cff2 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -26,7 +26,7 @@ module Arel SELECT raw_sql_.*, rownum raw_rnum_ FROM (#{sql}) raw_sql_ ) - WHERE raw_rnum_ between #{offset.expr.to_i + 1 } and #{offset.expr.to_i + limit} + WHERE raw_rnum_ >= #{offset.expr.to_i + 1 } and rownum <= #{limit} eosql end diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb index af81f2058b..42bfaadf8a 100644 --- a/test/visitors/test_oracle.rb +++ b/test/visitors/test_oracle.rb @@ -103,7 +103,7 @@ module Arel SELECT raw_sql_.*, rownum raw_rnum_ FROM (SELECT) raw_sql_ ) - WHERE raw_rnum_ between 11 and 20 + WHERE raw_rnum_ >= 11 and rownum <= 10 } end