aboutsummaryrefslogtreecommitdiffstats
path: root/spec/visitors
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-29 13:38:40 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-29 13:38:40 -0700
commit5ec2fac114b1c70fe7ac87f4767b6f1cbc1e78fc (patch)
tree8fd01c74ec25d602c769c75d44aa3f26a65eac31 /spec/visitors
parentcf1db3ce28e6c9fcf6fc724f5467e6b6b450f8bf (diff)
parente619462165bfab5bee85f9761df7f48a6b8f30f0 (diff)
downloadrails-5ec2fac114b1c70fe7ac87f4767b6f1cbc1e78fc.tar.gz
rails-5ec2fac114b1c70fe7ac87f4767b6f1cbc1e78fc.tar.bz2
rails-5ec2fac114b1c70fe7ac87f4767b6f1cbc1e78fc.zip
Merge branch 'master' of github.com:brynary/arel
* 'master' of github.com:brynary/arel: use subquery for limit when DISTINCT is used (in Oracle) added missing require 'spec_helper' in crud_spec.rb
Diffstat (limited to 'spec/visitors')
-rw-r--r--spec/visitors/oracle_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/visitors/oracle_spec.rb b/spec/visitors/oracle_spec.rb
index cdf0e3427f..93ade3ef3c 100644
--- a/spec/visitors/oracle_spec.rb
+++ b/spec/visitors/oracle_spec.rb
@@ -71,6 +71,16 @@ module Arel
}
end
+ it 'creates a subquery when there is DISTINCT' do
+ stmt = Nodes::SelectStatement.new
+ stmt.cores.first.projections << Nodes::SqlLiteral.new('DISTINCT id')
+ stmt.limit = 10
+ sql = @visitor.accept stmt
+ sql.should be_like %{
+ SELECT * FROM (SELECT DISTINCT id) WHERE ROWNUM <= 10
+ }
+ end
+
it 'creates a different subquery when there is an offset' do
stmt = Nodes::SelectStatement.new
stmt.limit = 10