提交 60793cc2 编写于 作者: J Jeremy Kemper

SQLServer: more compatible limit/offset emulation. Closes #3779.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3564 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 76540822
*SVN*
* SQLServer: more compatible limit/offset emulation. #3779 [Tom Ward]
* Polymorphic join support for has_one associations (has_one :foo, :as => :bar) #3785 [Rick Olson]
* PostgreSQL: correctly parse negative integer column defaults. #3776 [bellis@deepthought.org]
......
......@@ -375,7 +375,9 @@ def add_limit_offset!(sql, options)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册