Rails4: replace deprecated #connection from IssueQuery model
DEPRECATION WARNING: #connection is deprecated in favour of accessing it via the class. git-svn-id: http://svn.redmine.org/redmine/trunk@12717 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ecf27b3f12
commit
6be972af35
|
@ -429,7 +429,7 @@ class IssueQuery < Query
|
||||||
" WHERE #{Member.table_name}.project_id = #{Issue.table_name}.project_id))"
|
" WHERE #{Member.table_name}.project_id = #{Issue.table_name}.project_id))"
|
||||||
when "=", "!"
|
when "=", "!"
|
||||||
role_cond = value.any? ?
|
role_cond = value.any? ?
|
||||||
"#{MemberRole.table_name}.role_id IN (" + value.collect{|val| "'#{connection.quote_string(val)}'"}.join(",") + ")" :
|
"#{MemberRole.table_name}.role_id IN (" + value.collect{|val| "'#{ActiveRecord::Base.connection.quote_string(val)}'"}.join(",") + ")" :
|
||||||
"1=0"
|
"1=0"
|
||||||
|
|
||||||
sw = operator == "!" ? 'NOT' : ''
|
sw = operator == "!" ? 'NOT' : ''
|
||||||
|
@ -441,7 +441,7 @@ class IssueQuery < Query
|
||||||
|
|
||||||
def sql_for_is_private_field(field, operator, value)
|
def sql_for_is_private_field(field, operator, value)
|
||||||
op = (operator == "=" ? 'IN' : 'NOT IN')
|
op = (operator == "=" ? 'IN' : 'NOT IN')
|
||||||
va = value.map {|v| v == '0' ? connection.quoted_false : connection.quoted_true}.uniq.join(',')
|
va = value.map {|v| v == '0' ? connection.quoted_false : ActiveRecord::Base.connection.quoted_true}.uniq.join(',')
|
||||||
|
|
||||||
"#{Issue.table_name}.is_private #{op} (#{va})"
|
"#{Issue.table_name}.is_private #{op} (#{va})"
|
||||||
end
|
end
|
||||||
|
@ -460,14 +460,14 @@ class IssueQuery < Query
|
||||||
sql = case operator
|
sql = case operator
|
||||||
when "*", "!*"
|
when "*", "!*"
|
||||||
op = (operator == "*" ? 'IN' : 'NOT IN')
|
op = (operator == "*" ? 'IN' : 'NOT IN')
|
||||||
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{connection.quote_string(relation_type)}')"
|
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{ActiveRecord::Base.connection.quote_string(relation_type)}')"
|
||||||
when "=", "!"
|
when "=", "!"
|
||||||
op = (operator == "=" ? 'IN' : 'NOT IN')
|
op = (operator == "=" ? 'IN' : 'NOT IN')
|
||||||
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = #{value.first.to_i})"
|
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name} WHERE #{IssueRelation.table_name}.relation_type = '#{ActiveRecord::Base.connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = #{value.first.to_i})"
|
||||||
when "=p", "=!p", "!p"
|
when "=p", "=!p", "!p"
|
||||||
op = (operator == "!p" ? 'NOT IN' : 'IN')
|
op = (operator == "!p" ? 'NOT IN' : 'IN')
|
||||||
comp = (operator == "=!p" ? '<>' : '=')
|
comp = (operator == "=!p" ? '<>' : '=')
|
||||||
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name}, #{Issue.table_name} relissues WHERE #{IssueRelation.table_name}.relation_type = '#{connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = relissues.id AND relissues.project_id #{comp} #{value.first.to_i})"
|
"#{Issue.table_name}.id #{op} (SELECT DISTINCT #{IssueRelation.table_name}.#{join_column} FROM #{IssueRelation.table_name}, #{Issue.table_name} relissues WHERE #{IssueRelation.table_name}.relation_type = '#{ActiveRecord::Base.connection.quote_string(relation_type)}' AND #{IssueRelation.table_name}.#{target_join_column} = relissues.id AND relissues.project_id #{comp} #{value.first.to_i})"
|
||||||
end
|
end
|
||||||
|
|
||||||
if relation_options[:sym] == field && !options[:reverse]
|
if relation_options[:sym] == field && !options[:reverse]
|
||||||
|
|
Loading…
Reference in New Issue