Nested Transactions with DBXIDA

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
dany40
Posts: 17
Joined: Fri 04 Jul 2008 12:42

Nested Transactions with DBXIDA

Post by dany40 » Fri 11 Sep 2009 00:12

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 11 Sep 2009 11:41

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.

dany40
Posts: 17
Joined: Fri 04 Jul 2008 12:42

Post by dany40 » Fri 11 Sep 2009 12:08

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

dany40
Posts: 17
Joined: Fri 04 Jul 2008 12:42

Post by dany40 » Fri 11 Sep 2009 12:40

... 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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 14 Sep 2009 10:59

If you open a transaction manually, ApplyUpdates is executed in this transaction. You can call ApplyUpdates for all datasets, then commit the transaction.

dany40
Posts: 17
Joined: Fri 04 Jul 2008 12:42

Post by dany40 » Fri 18 Sep 2009 16:27

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

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Mon 21 Sep 2009 07:50

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.

dany40
Posts: 17
Joined: Fri 04 Jul 2008 12:42

Post by dany40 » Mon 21 Sep 2009 19:06

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

Post Reply