提交 6c1a356a 编写于 作者: J Jeremy Kemper

SQLServer: resolve column aliasing/quoting collision when using limit or...

SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find.  References #2974.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3184 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 2b285757
*SVN*
* SQLServer: resolve column aliasing/quoting collision when using limit or offset in an eager find. #2974 [kajism@yahoo.com]
* Reloading a model doesn't lose track of its connection. #2996 [junk@miriamtech.com, Jeremy Kemper]
* Fixed bug where using update_attribute after pushing a record to a habtm association of the object caused duplicate rows in the join table. #2888 [colman@rominato.com, Florian Weber]
......
......@@ -356,7 +356,12 @@ def add_limit_offset!(sql, options)
if options[:order]
options[:order] = options[:order].split(',').map do |field|
parts = field.split(" ")
if sql =~ /#{parts[0]} AS (t\d_r\d\d?)/
tc = parts[0]
if sql =~ /\.\[/ and tc =~ /\./ # if column quoting used in query
tc.gsub!(/\./, '\\.\\[')
tc << '\\]'
end
if sql =~ /#{tc} AS (t\d_r\d\d?)/
parts[0] = $1
end
parts.join(' ')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册