diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-02-09 21:42:29 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-02-09 21:42:29 +0000 |
commit | 60793cc27f4e930c3139d4ab296c5df443c0623c (patch) | |
tree | 1a8198f29c84266748114cf2a06a2e7241a0e19e /activerecord/lib | |
parent | 76540822609415dc5cfa8ea31bfafea602373a27 (diff) | |
download | rails-60793cc27f4e930c3139d4ab296c5df443c0623c.tar.gz rails-60793cc27f4e930c3139d4ab296c5df443c0623c.tar.bz2 rails-60793cc27f4e930c3139d4ab296c5df443c0623c.zip |
SQLServer: more compatible limit/offset emulation. Closes #3779.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb index 9d7174007c..708ec086fd 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb @@ -375,7 +375,9 @@ module ActiveRecord sql << " ) AS tmp2" end elsif sql !~ /^\s*SELECT (@@|COUNT\()/i - sql.sub!(/^\s*SELECT/i, "SELECT TOP #{options[:limit]}") unless options[:limit].nil? + sql.sub!(/^\s*SELECT([\s]*distinct)?/i) do + "SELECT#{$1} TOP #{options[:limit]}" + end unless options[:limit].nil? end end |