Handle different parameter types correctly

For some reason arrays, strings, or fixnums are passed to #collection. A
real fix would find the source for the different value paramters and fix
it. But, unfortunately, this fix is much simpler to apply.
pull/6827/head
Hagen Schink 11 years ago
parent 7164d2dc19
commit bf1683e67f
  1. 9
      lib/report/query_utils.rb

@ -69,11 +69,10 @@ module Report::QueryUtils
# @param [#flatten] *values Ruby collection
# @return [String] SQL collection
def collection(*values)
if values.empty?
""
else
"(#{values.to_s.split(',').flatten.map { |x| "'#{quote_string(x)}'" }.join(", ")})"
end
return "" if values.empty?
v = (values.is_a? Array) ? values : values.to_s.split(',')
"(#{v.flatten.map { |x| "'#{quote_string(x)}'" }.join(", ")})"
end
##

Loading…
Cancel
Save