##// END OF EJS Templates
Use r13844 workaround for SQLServer only....
Jean-Philippe Lang -
r13463:dcda9977e376
parent child
Show More
@@ -149,12 +149,17 module Redmine
149 149 end
150 150
151 151 def lock_nested_set
152 lock = true
153 152 if self.class.connection.adapter_name =~ /sqlserver/i
154 153 lock = "WITH (ROWLOCK HOLDLOCK UPDLOCK)"
155 end
154 # Custom lock for SQLServer
155 # This can be problematic if root_id or parent root_id changes
156 # before locking
156 157 sets_to_lock = [root_id, parent.try(:root_id)].compact.uniq
157 158 self.class.reorder(:id).where(:root_id => sets_to_lock).lock(lock).ids
159 else
160 sets_to_lock = [id, parent_id].compact
161 self.class.reorder(:id).where("root_id IN (SELECT root_id FROM #{self.class.table_name} WHERE id IN (?))", sets_to_lock).lock.ids
162 end
158 163 end
159 164
160 165 def nested_set_scope
General Comments 0
You need to be logged in to leave comments. Login now