Additional
AnyDAC
SimpleIAX
Forums
Welcome, Guest
Please Login or Register to post messages. Lost Password?
Records got lost
(1 viewing) 1 Guest
Go to bottom
TOPIC: Records got lost
#20026
PaulBr
Junior Boarder
Posts: 24
graphgraph
Karma: 0
User Offline Click here to see the profile of this user
Re:Records got lost 2012/01/25 08:31 (3 Months, 3 Weeks ago)
Hello,

because of this bug we have big problems with our customer.

When can we get an update?!

Thanks!
Logged Logged
The administrator has disabled public write access.
#20033
TSupport
Moderator
Posts: 279
graphgraph
Karma: 7
User Offline Click here to see the profile of this user
Re:Records got lost 2012/01/26 01:37 (3 Months, 3 Weeks ago)
Hello Paul,

We reviewed that once again + your setting in TADConnection and TADTable components.
The way it's configured now the application works as designed.
Your connection has the pessimistic (more) locking mode:
Code:

object AnyConnection1: TADConnection
    UpdateOptions.LockMode = lmPessimistic
    UpdateOptions.LockPoint = lpImmediate
    UpdateOptions.LockWait = True


That will in turn mean that for ADTable2 on Edit method call the record will be locked and a transaction started.
On Cancel the transaction will be rolled back.
Your options in this case could be:
- wrapping all code into explicit StartTransaction / Commit calls:
Code:

AnyConnection1.StartTransaction;
ADTable2.Edit;
ADTable1.Insert;
ADTable1.Post;
ADTable2.Cancel;
AnyConnection1.Commit;


- not using pessimistic locking for AnyConnection1
- not using pessimistic locking for ADTable2 (setting its UpdateOptions will override connection ones)

Please let us know if this helped.
With best regards,
DA-SOFT Technologies Support Team
Logged Logged
The administrator has disabled public write access.
#20034
PaulBr
Junior Boarder
Posts: 24
graphgraph
Karma: 0
User Offline Click here to see the profile of this user
Re:Records got lost 2012/01/26 02:08 (3 Months, 3 Weeks ago)
hello,

first of all, we need pessimistic locking!

The example code was just to illustrate the problem.

We have many forms with tableobjects and our customer can switch between these forms. So he works in form1 and edit the table in this form. Now he changes to form2 (the table in form1 is still in editmode) and works there (Perhaps he writes 5 invoices ). Then he returns to form1 and cancel the table. The result is: The invoices are gone. That can't be!
Logged Logged
The administrator has disabled public write access.
#20035
Support
Moderator
Posts: 4708
graph
Karma: 68
User Offline Click here to see the profile of this user
Re:Records got lost 2012/01/26 02:20 (3 Months, 3 Weeks ago)
To set a pessimistic lock a transaction must be started, then a lock will be placed. To cancel editing and release the lock, the transaction must be rolled back.

MySQL supports only single transaction per connection. So, it is impossible to manage two and more pessimistic locks in the same connection independently. This is not AnyDAC limitation, it is how MySQL is designed. For example, the same will be with Oracle or SQL Server. But with Firebird you may have few active transactions in the same connection.

Additional option to the previous post is to use a dedicated connection for each form. Then each form will be able to manage pessimistic lock independently from other active forms.
With best regards,
DA-SOFT Technologies Support Team
Logged Logged
Last Edit: 2012/01/26 02:26 By Support.
The administrator has disabled public write access.
#20046
PaulBr
Junior Boarder
Posts: 24
graphgraph
Karma: 0
User Offline Click here to see the profile of this user
Re:Records got lost 2012/01/27 04:25 (3 Months, 3 Weeks ago)
Thanks Dmitry,

for your answer.
Ok, i have to use a dedicated connection for each form...
Logged Logged
The administrator has disabled public write access.
#20048
Support
Moderator
Posts: 4708
graph
Karma: 68
User Offline Click here to see the profile of this user
Re:Records got lost 2012/01/27 04:36 (3 Months, 3 Weeks ago)
You welcome.

But be carefull, because different connections may not see each other data changes, may lead to locking of each other, etc.
With best regards,
DA-SOFT Technologies Support Team
Logged Logged
The administrator has disabled public write access.
Go to top