I am using Delphi 2010 with FIB Components
like TpFIBDataset
, TpFIBTransaction
and TpFIBDataset
with Firebird
database.
I have already set TpFIBDataset's 'AutoCommit' property to 'False', then also when I execute below statement in the try..finally
block and rollback the transaction data still get posted.
Code:
FIBDataset.Post;
Below is the sample code.
Code:
try
FIBDatabase.StartTransaction;
....
Block of Code;
...
finally
if saveALL then
FIBDatabase.CommitRetaining
else
FIBDatabase.RollbackRetaining;
end;
The Transaction on the dataset must also be checked and changed
FIBDataset.AutoCommit := false;
You need to Close the query as well. In this case
FIBDataset.Close;
FIBDatabase.Rollback;
EDIT
I would also advise you to allocate the one transaction component to all the datasets (rather than the database). And use the start, commit, rollback methods of the transaction component. Further, you must assign the transaction component before you do any operations.