提交 a0c206b3 编写于 作者: A Aaron Patterson

Merge branch 'master' of github.com:brynary/arel

* 'master' of github.com:brynary/arel:
  fix order_hacks method for Oracle when complex functions are used in order by
......@@ -70,7 +70,23 @@ def order_hacks o
/DISTINCT.*FIRST_VALUE/ === projection
end
end
orders = o.orders.map { |x| visit x }.join(', ').split(',')
# FIXME: previous version with join and split broke ORDER BY clause
# if it contained functions with several arguments (separated by ',').
# Currently splitting is done only if there is no function calls
#
# orders = o.orders.map { |x| visit x }.join(', ').split(',')
orders = o.orders.map do |x|
string = visit x
# if there is function call
if string.include?('(')
string
# if no function call then comma splits several ORDER BY columns
elsif string.include?(',')
string.split(',')
else
string
end
end.flatten
o.orders = []
orders.each_with_index do |order, i|
o.orders <<
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册