Hello,
If a record is locked by someone else, is there a possibility that this record can unlocked by another user?
Thank you.
driessen wrote:Hello,
If a record is locked by someone else, is there a possibility that this record can unlocked by another user?
Thank you.
nageswaragunupudi wrote:Well behaved programs never lock a record and wait for a user action.
Lock only when all data is ready, then lock and write all data and unlock immediately.
The entire action should not take more than a fraction of a second.
nEvent := 0
DO WHILE !lExit
nEvent := APPEVENT( @mp1, @mp2, @oXbp, nTime ) // 4th Parameter Timeout
DO CASE
CASE nEvent == xbe_None
EXIT
METHOD RLock(f_nRecno, f_nLockSeconds) Class TAds
Local lLockRecno := .F., iForTentativa := 0, lc_nLockLoops := 0
Default f_nRecno := (::cAlias)->(Recno()), f_nLockSeconds := 5
lc_nLockLoops := (f_nLockSeconds / 0.2)
If (::cAlias)->(Recno()) != f_nRecno
(::cAlias)->(DbGoTo(f_nRecno))
::OnSkip()
EndIf
For iForTentativa := 1 To lc_nLockLoops
(::cAlias)->(AdsRefreshRecord())
If (::cAlias)->(DbRLock())
::cAuditProcess += If(!Empty(::cAuditProcess),Replicate("-",80)+CRLF,"")
::cAuditProcess += "ACE Api > AdsLockRecord("+cValToStr(::Recno())+") Table "+;
::cTableName+CRLF
::lAppendRecord := .F.
lLockRecno := .T.
Exit
Else
SysWait(.2)
EndIf
Next
RETURN lLockRecno
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 95 guests