aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2016-08-05 18:58:29 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2016-08-08 14:06:18 +0000
commit20501d7ae24afca86f5b6de6f4914e1a6d9d1ac0 (patch)
tree2303c519a03f872c1435e2a0f027f1f64977f285 /activerecord
parent996a27ec3adeee5bcda49dcf4ceb168da981080e (diff)
downloadrails-20501d7ae24afca86f5b6de6f4914e1a6d9d1ac0.tar.gz
rails-20501d7ae24afca86f5b6de6f4914e1a6d9d1ac0.tar.bz2
rails-20501d7ae24afca86f5b6de6f4914e1a6d9d1ac0.zip
Use `FETCH FIRST` for Oracle12 database and Arel Oracle12 visitor
also test `ROWNUM <=` for Oracle 11g or older version of Oracle and Oracle visitor Oracle 12c database and Arel Oracle12 visitor supports better top N query.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/finder_test.rb6
-rw-r--r--activerecord/test/cases/scoping/relation_scoping_test.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 64251c5d11..bf0ce18bb8 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -562,9 +562,9 @@ class FinderTest < ActiveRecord::TestCase
end
def test_take_and_first_and_last_with_integer_should_use_sql_limit
- assert_sql(/LIMIT|ROWNUM <=/) { Topic.take(3).entries }
- assert_sql(/LIMIT|ROWNUM <=/) { Topic.first(2).entries }
- assert_sql(/LIMIT|ROWNUM <=/) { Topic.last(5).entries }
+ assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.take(3).entries }
+ assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.first(2).entries }
+ assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) { Topic.last(5).entries }
end
def test_last_with_integer_and_order_should_keep_the_order
diff --git a/activerecord/test/cases/scoping/relation_scoping_test.rb b/activerecord/test/cases/scoping/relation_scoping_test.rb
index 0428e1640e..13007e2e73 100644
--- a/activerecord/test/cases/scoping/relation_scoping_test.rb
+++ b/activerecord/test/cases/scoping/relation_scoping_test.rb
@@ -246,7 +246,7 @@ class NestedRelationScopingTest < ActiveRecord::TestCase
devs = Developer.all
sql = devs.to_sql
assert_match "(salary = 80000)", sql
- assert_match "LIMIT 10", sql
+ assert_match /LIMIT 10|ROWNUM <= 10|FETCH FIRST 10 ROWS ONLY/, sql
end
end
end