Permalink
Browse files

Add oracle paging optimization discussed in issue 99

  • Loading branch information...
1 parent 38d0a22 commit 78977c9c5fa6edd7eaa46cf8ff380b4e25825d5d @t0m t0m committed Jan 8, 2013
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/arel/visitors/oracle.rb
  2. +1 −1 test/visitors/test_oracle.rb
@@ -26,7 +26,7 @@ def visit_Arel_Nodes_SelectStatement o
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
@@ -103,7 +103,7 @@ module Visitors
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

0 comments on commit 78977c9

Please sign in to comment.