Subject Re: [firebird-support] get_lock / release_lock
Author Robert
You can't do it by username if there is a possibility the user can
connect to the database in more than one session. You need your
application to generate a unique session ID for each session, and use
that sessionID to tell if the requesting session got the lock. You
also need a timestamp field so that all sessions can delete stale locks
(such as might be created when a session dies).

Just my two eurocent's worth.

Regards,

Robert.


Kjell Rilbe wrote:
> Martijn Tonies wrote:
>
>> > Can't they put in a where condition in the update double checking that
>> > the locked_by is null?
>>
>> Sure, but what if it was unlocked already by a user, then it will
>> overwrite the changes without even knowing there were changes.
>
> I expect Steve meant:
>
> 1. User 1: update <table> set LockedByUser = 'Me' where RecId =
> something and LockedByUser is null, then check that 1 rec was updated.
> If not, then someone already had the lock.
>
> I expect this would work...?
>
> Kjell

No virus found in this outgoing message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.9/1583 - Release Date: 31/07/2008 06:17


No virus found in this outgoing message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.9/1583 - Release Date: 31/07/2008 06:17