hi,
I use Unidac 4.6.11 in Delphi XE2 , I have two Queries which are in cached updates mode , also both of them have same update transaction (UniTransaction1), this is the code that I use in the save button :
UniTransaction1.StartTransaction;
try
Query2.applyupdates;
Query1.applyupdates;
UniTransaction1.Commit;
except
UniTransaction1.RollBack;
end;
if one of the queries fail , both of them must be rollbacked , but the problem is that even if one of them fails the other saves normally.
I need to know where is the problem in my code. and if you have another approach please advice me.
thanks in advance.
Rollback issue when using two queries with cached updates
-
Ali.Mustapha
- Posts: 7
- Joined: Fri 02 May 2014 13:37
-
Ali.Mustapha
- Posts: 7
- Joined: Fri 02 May 2014 13:37
Re: Rollback issue when using two queries with cached updates
i just found the solution with setting the auto commit of the queries to False ,
I just have another question is there any need to disable the auto commit of the uni connection or just for the needed query ???
I just have another question is there any need to disable the auto commit of the uni connection or just for the needed query ???
Re: Rollback issue when using two queries with cached updates
Please specify the database you are working with.
-
Ali.Mustapha
- Posts: 7
- Joined: Fri 02 May 2014 13:37
Re: Rollback issue when using two queries with cached updates
You have found a correct solution for this case by setting the TUniQuery.AutoCommit property to False.
The TIBCConnection.AutoCommit property has higher priority than the AutoCommit property of datasets (TIBCQuery, TIBCTable).
If the TIBCConnection.AutoCommit property is set to False, all transactions can be committed only explicitly (despite the AutoCommit property value of a dataset).
The TIBCConnection.AutoCommit property has higher priority than the AutoCommit property of datasets (TIBCQuery, TIBCTable).
If the TIBCConnection.AutoCommit property is set to False, all transactions can be committed only explicitly (despite the AutoCommit property value of a dataset).