Page 1 of 1
Nested Transactions with DBXIDA
Posted: Fri 11 Sep 2009 00:12
by dany40
Hi;
After opening the connection, I can see FSupportsNestedTrans = True. But I can't take advantage from nested transactions.
First I start a transaction with a special ID=10
Then I run:
CDS1.ApplyUpdates ...
CDS2.ApplyUpdates ...
CDS3.ApplyUpdates ...
if one of that ApplyUpdates(0) 0 I break the process and then I rollback the transaction ID=10.
This process worked fine with some drivers, but I can't make it running now.
What can it be?
Thank you
Dany
Posted: Fri 11 Sep 2009 11:41
by Plash
DbxIda actually supports parallel transactions but not nested.
Parallel transactions are independent from each other. When you rollback one transaction, this does not affect other transactions.
Posted: Fri 11 Sep 2009 12:08
by dany40
Well, this is a very bad notice for me. Nested transactions are very necesary, and more if we use ClientDataSet->DataSetProvider->SQLDataset->SQLConnection because there are lots of situations in were we have to update more than one Dataset and we need the whole process to work as only one block.
Firebird, Oracle, and PostresSQL supports nested transactions; please tell me if I have any way of tacking advantage of that in any way. Otherwise, is very dificult to use Devarts DBX drivers.
Dany
Posted: Fri 11 Sep 2009 12:40
by dany40
... if I open a transaction by hand, does the driver open other transactions internaly for doing the ApplyUpdates?, or does it use my opened one?.
I just have to update more than one dataset, but in only one transaction block; It is not crazy ... I gess.
Dany
Posted: Mon 14 Sep 2009 10:59
by Plash
If you open a transaction manually, ApplyUpdates is executed in this transaction. You can call ApplyUpdates for all datasets, then commit the transaction.
Posted: Fri 18 Sep 2009 16:27
by dany40
Hi;
Plash wrote:If you open a transaction manually, ApplyUpdates is executed in this transaction. You can call ApplyUpdates for all datasets, then commit the transaction.
Well, this is exactly what I am trying to do, but it does not work. For example:
StarMyTransaction;
try
ClientDataSet1.ApplyUpdate(0) 0 then raise Excep ....
ClientDataSet2.ApplyUpdate(0) 0 then raise Excep ....
ClientDataSet3.ApplyUpdate(0) 0 then raise Excep ....
CommiMyTransaction;
except
on exception do RollbackMyTransaction;
end;
If, for example, ClientDataSet 3 raises the error, I expect a rollback of what I did in ClientDataSets 1 and 2; but it is not working. Both are saved on the database.
My approach worked fine with before, using other drivers.
Dany
Posted: Mon 21 Sep 2009 07:50
by Plash
We could not reproduce the problem. Please send to support*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.
Please specify your Delphi version.
Posted: Mon 21 Sep 2009 19:06
by dany40
Hi;
I tried to make a separated example showing the problem, but founding I can´t reproduce it.
Besides, now my proyect is working fine too.
I don´t know what happen or what changed (maybe it was only my mistake) but all is working.
I apologize for this thread.
Dany