diff options
author | babinho <babinho@gmail.com> | 2012-02-17 09:47:31 +0100 |
---|---|---|
committer | babinho <babinho@gmail.com> | 2012-02-17 09:47:31 +0100 |
commit | d1c9c46c96c016b6561018d8017261feea3912a7 (patch) | |
tree | c6dddba78f9fd5d5eb32b7fdfc3476c3c080e3f9 | |
parent | eebf5d77aad712fad27a3adf70cd0ab2e8246668 (diff) | |
download | rails-d1c9c46c96c016b6561018d8017261feea3912a7.tar.gz rails-d1c9c46c96c016b6561018d8017261feea3912a7.tar.bz2 rails-d1c9c46c96c016b6561018d8017261feea3912a7.zip |
Oracle limit and offset issue when query is ordered, issue #99 solved.
-rw-r--r-- | lib/arel/visitors/oracle.rb | 3 | ||||
-rw-r--r-- | test/visitors/test_oracle.rb | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index 375f7dbfe9..1441a20dbc 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -25,9 +25,8 @@ module Arel SELECT * FROM ( SELECT raw_sql_.*, rownum raw_rnum_ FROM (#{sql}) raw_sql_ - WHERE rownum <= #{offset.expr.to_i + limit} ) - WHERE #{visit offset} + WHERE raw_rnum_ between #{offset.expr.to_i + 1 } and #{offset.expr.to_i + limit} eosql end diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb index 9a5fa304ab..af81f2058b 100644 --- a/test/visitors/test_oracle.rb +++ b/test/visitors/test_oracle.rb @@ -102,9 +102,8 @@ module Arel SELECT * FROM ( SELECT raw_sql_.*, rownum raw_rnum_ FROM (SELECT) raw_sql_ - WHERE rownum <= 20 ) - WHERE raw_rnum_ > 10 + WHERE raw_rnum_ between 11 and 20 } end |