Paradox Community

Items in pnews.paradox-programming

Subject:Re: lockRecord() - doesn't
Date:Wed, 20 Jul 2022 13:32:04 -0800
From:Peter <peterspammenot@whiteknight.email>
Newsgroups:pnews.paradox-programming
try/endtry is what I normally do but I was trying to show just minimum 
to keep it simple as possible

This code should produce the same results as yours
Machine_1
var
    tcu                tcursor
endVar

;//open tcursor on tbl
errorTrapOnWarnings(YES)

try
    tcu.open(":ZONE:ProcLock.db")
    tcu.edit()
    tcu.lockRecord()
OnFail
       errorShow()
endTry

errorTrapOnWarnings(NO)

If I check locks interactively (Tools | Security | Display Locks) it 
only shows open and image locks

if I do it using
tcu2.open(":ZONE:ProcLock.db")
tcu2.enumLocks(":PRIV:Locks")

Then it shows the record lock

Machine_2
Interactive or programmatically (enumlocks) it does not show the record 
lock of Machine_1, however it does show the open and image locks of both 
machines

Further
If on Machine_2 I run the same code as Machine_1 then enumlocks will 
show the record lock for Machine_2, but not Machine_1.

Same results for Machine_3

So it looks like the record lock is only shown for the machine that 
placed it but not the other machinesè record locks. tcursors are not 
closed and form remains open so record lock should be in effect.

Network is peer-to-peer and table locking is recognized by all machines. 
Just lockRecord() giving me grief.




On 07/19/2022 10:43 p.m., Tom Krieg wrote:
> Try to qlocate the record, or move to the record you want, then try
> 
> var erc logical endvar
> erc= true
> if tcu.edit() then
>     if tcu.lockrecord() then
>        erc = false
>        do whatever
>     endif
> endif
> if erc then
>     display error
> endif
> 
> What happens?
> 
> open() and edit() doesn't throw an error unless in a try block.
> 
> 
> 
> On 20/07/2022 2:26 pm, Peter wrote:
>> So I've been playing with this for the better part of the day and I 
>> can't figure it out.
>>
>> Machine_1
>> I place a lockrecord on a record in a table but when I display locks 
>> (interactive) it does not show up.
>>
>> eg.
>> tcu.open(":SCHEDULE:ProcLock.db")
>> tcu.edit()
>> tcu.lockRecord()    ;//lock 1st record, the only record in the tbl
>>
>> If I try programmatically:
>>     1) enumlocks(), doesn't show up
>>     2) tcu.lockStatus("Any"), doesn't show up
>>
>>
>> Machine_2
>> When I display locks (interactive) on Machine_2 it also does not 
>> display the record lock from Machine_1 - just the open lock.
>>
>> If I do it programmatically (enumLock), same thing, the record lock 
>> that is set by Machine_1 does not show.
>>
>> I don't want to use a table/session lock, just a single record. Any 
>> secrets on getting all Machines to recognize a lockRecord()?
>>
>> Thanks
> 


Copyright © 2004 thedbcommunity.com