Optimistic locking

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Max Bernaert
Posts: 3
Joined: Mon 31 Jul 2006 10:25
Location: Belgium

Optimistic locking

Post by Max Bernaert » Sat 28 Mar 2015 23:33

I use pessimitic locking since a long time with your components and Firebird. I never had problems in the past. But recently with version 2.5.3 in sometimes I have some records remaining locked (after a batch update with a lot of records retrieval, udpates and appends).
I want to move to optimistic locking as this is the advised solution.
I tested it with but the changes of user 1 are overwritten by the changes of a second user without error.
I have a Query component with a transaction component.
In the query component I have ImLockDelayed in the lock mode.
In the transaction I refer to a transaction component with IblReadOnlyReadCommitted and in the UpdateTransaction I refer to a transaction component with IblReadCommitted.
I use twice the program and updating a record in the 2 programs. The changes made by the first user are overwritten by the second user.

Can you help me ?

Thanks for your response.

Max.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Optimistic locking

Post by ViktorV » Mon 30 Mar 2015 08:57

Please describe the problem in more details. The described behavior of TIBCQuery is correct. If the TIBCQuery.LockMode property is set to lmLockDelayed, the record will be locked just before calling the Post method. Therefore the data changes of the application, that was the last to call the TIBCQuery.Post method, will be saved on the server.

Post Reply