sonar-openedge
sonar-openedge copied to clipboard
Detect GET FIRST/GET LAST without lock
A rule to detect GET-FIRST/GET-LAST without an explicit lock would be nice. Using this without a lock can lead to problems like error 2819 and other problems.
Quote from the doc:
The GET statement inherits its lock mode from the most recent OPEN QUERY statement, unless you give a lock-mode on the GET itself. So if you do an OPEN QUERY... EXCLUSIVE-LOCK, and then do a subsequent GET on that query, the GET will be EXCLUSIVE-LOCK too.
#880 is a related i guess.
I'll have a look, I thought the problem was fixed as part of #880.
The GET-FIRST and GET-LAST methods use NO-LOCK by default, so I assume you're talking about the GET statement with a modifier on a static query ? e.g.
define query qry for customer.
open query for each customer.
get first qry. // Missing lock as it's not specified in the open query statement
get next qry. // Ditto
The
GET-FIRSTandGET-LASTmethods useNO-LOCKby default, so I assume you're talking about theGETstatement with a modifier on a static query ? e.g.define query qry for customer. open query for each customer. get first qry. // Missing lock as it's not specified in the open query statement get next qry. // Ditto
Yes, i typed the hyphen out of habit :D.