aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-10-07 15:28:48 -0400
committerGitHub <noreply@github.com>2016-10-07 15:28:48 -0400
commit3eddc2fd444c8a0a5f6c96614874d1437b5b55ab (patch)
treed20255ace6a58aa83104f7fe387889fdbc790102 /test
parent44d2ef9623847dea5cbf6208ae7b5168b374c720 (diff)
parent9d6e569ddfed10b437494ecb6e995048737beb44 (diff)
downloadrails-3eddc2fd444c8a0a5f6c96614874d1437b5b55ab.tar.gz
rails-3eddc2fd444c8a0a5f6c96614874d1437b5b55ab.tar.bz2
rails-3eddc2fd444c8a0a5f6c96614874d1437b5b55ab.zip
Merge pull request #450 from roooodcastro/issue-438
Use Arel::Nodes::BindParam in Oracle visitor for queries using both LIMIT and OFFSET
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_oracle.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb
index e9ed9d76b3..4c22be5cbb 100644
--- a/test/visitors/test_oracle.rb
+++ b/test/visitors/test_oracle.rb
@@ -124,6 +124,21 @@ module Arel
}
end
+ it 'creates a subquery when there is limit and offset with BindParams' do
+ stmt = Nodes::SelectStatement.new
+ stmt.limit = Nodes::Limit.new(Nodes::BindParam.new)
+ stmt.offset = Nodes::Offset.new(Nodes::BindParam.new)
+ sql = compile stmt
+ sql.must_be_like %{
+ SELECT * FROM (
+ SELECT raw_sql_.*, rownum raw_rnum_
+ FROM (SELECT ) raw_sql_
+ WHERE rownum <= (:a1 + :a2)
+ )
+ WHERE raw_rnum_ > :a1
+ }
+ end
+
it 'is idempotent with different subquery' do
stmt = Nodes::SelectStatement.new
stmt.limit = Nodes::Limit.new(10)
@@ -148,7 +163,6 @@ module Arel
}
end
end
-
end
it 'modified except to be minus' do