1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2024-12-14 06:07:00 +02:00
v8-code-style/bundles/com.e1c.v8codestyle.ql/markdown/ql-using-for-update.md

792 B

Using "FOR UPDATE" clause

The FOR UPDATE clause is intended for locking specific data (which is avaialble for reading from a transaction belonging to another connection) in advance while it is being read, to avoid deadlocks later, when it will be written. We do not recommended that you use the FOR UPDATE clause as it is irrelevant in managed lock mode.

Noncompliant Code Example

SELECT 
   Doc.Ref 
FROM 
   Document.RetailSale Doc
WHERE 
   Doc.Ref = &DocumentRef
FOR UPDATE AccumulationRegister.MutualSettlementsByAgreement.Balance

Compliant Solution

SELECT 
   Doc.Ref 
FROM 
   Document.RetailSale Doc
WHERE 
   Doc.Ref = &DocumentRef

See