From 58d82b23a102ca1eb5510b8c49bc097b402a332d Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 24 Sep 2010 10:24:31 -0700 Subject: dealing with limits and offsets --- spec/arel/visitors/oracle_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'spec/arel') diff --git a/spec/arel/visitors/oracle_spec.rb b/spec/arel/visitors/oracle_spec.rb index 87a1c378ac..07ac352893 100644 --- a/spec/arel/visitors/oracle_spec.rb +++ b/spec/arel/visitors/oracle_spec.rb @@ -25,6 +25,21 @@ module Arel SELECT * FROM (SELECT ORDER BY foo) WHERE ROWNUM <= 10 } end + + it 'creates a different subquery when there is an offset' do + stmt = Nodes::SelectStatement.new + stmt.limit = 10 + stmt.offset = Nodes::Offset.new(10) + sql = @visitor.accept stmt + sql.should be_like %{ + SELECT * FROM ( + SELECT raw_sql_.*, rownum raw_rnum_ + FROM (SELECT ) raw_sql_ + WHERE rownum <= 20 + ) + WHERE raw_rnum_ > 10 + } + end end end end -- cgit v1.2.3