Defect #23318 » mysql-deadlock-02.diff
| lib/redmine/nested_set/issue_nested_set.rb | ||
|---|---|---|
|
self.class.reorder(:id).where(:root_id => sets_to_lock).lock(lock).ids
|
||
|
else
|
||
|
sets_to_lock = [id, parent_id].compact
|
||
|
self.class.reorder(:id).where("root_id IN (SELECT root_id FROM #{self.class.table_name} WHERE id IN (?))", sets_to_lock).lock.ids
|
||
|
if Redmine::Database.postgresql?
|
||
|
self.class.reorder(:id).
|
||
|
where("root_id IN (SELECT root_id FROM #{self.class.table_name} WHERE id IN (?))", sets_to_lock).
|
||
|
lock.ids
|
||
|
else
|
||
|
inner_join_statement = self.class.select(:root_id).where(id: sets_to_lock).distinct(:root_id).to_sql
|
||
|
self.class.reorder(:id).
|
||
|
joins("INNER JOIN (#{inner_join_statement}) as i2 ON #{self.class.table_name}.root_id = i2.root_id").
|
||
|
lock.ids
|
||
|
end
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- 2
- Next »