Alaska Software Inc. - Re: DbRLock()/RLock() wrong behavior when locking Phantom Record(LastRec()+1) on Win 7/10.
Username: Password:
AuthorTopic: Re: DbRLock()/RLock() wrong behavior when locking Phantom Record(LastRec()+1) on Win 7/10.
Andreas Gehrs-Pahl

View the complete thread for this message in:

Re: DbRLock()/RLock() wrong behavior when locking Phantom Record(LastRec()+1) on Win 7/10.
on Thu, 14 Apr 2016 01:10:13 -0400
José

The only reason I can imagine why you would want to lock the ghost record, 
is to prevent a different process to a add a new record to the table. For 
this, you should instead use FLock(), even though this prevents write access 
to any record of the table.

Up to Build 1.30.212, locking the ghost record could result in DbAppend() 
running into an endless loop, hanging the application. This was apparently 
fixed with PDR 109-3545:

http://www.Alaska-Software.com/scripts/waa001.dll?WAA_PACKAGE=PUBLICDTS&WAA_FORM=DISPLAYPDR&PDRID=3545

The original solution/workaround for this PDR was to simply not to lock the 
ghost record. It looks like the final solution for the PDR was to allow 
locking of the ghost record, but without having an actual record lock -- as 
there really isn't a real record to lock.

So you now will always get .T. if you try to lock the ghost record, even it 
was already locked. This will apparently allow DbAppend() to work, even if 
the ghost record has been (supposedly) locked. But this will also no longer 
prevent a different process to append a new record.

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com