Controling transactions

I have noticed that TOracleDataSet executes a Commit statement if CachedUpdates is set to FALSE. I can not set the CachedUpdates property to TRUE because then I would have to use ROWID in select statement. We have our own TIQuery component which is derived from TOracleDataSet/TQuery, depends on conditional defines DOA/BDE (at least in theory
smile.gif


When working with DOA we use OnApplyRecord event from TOracleDataSet to do the work. (We parse statements from TUpdateSQL and then execute them in TOracleQuery.)

Imagine now you have two queries on which you issue ApplyUpdates. Now something goes wrong with the second one and there is no way to Rollback the entire transaction because Commit statement (InternalInsertUpdate in OracleData unit) was issued after the first one.

Would the following code be OK even if the Commit statement is issued:

Savepoint('INFONET')
try
quOne.ApplyUpdates;
quTwo.ApplyUpdates;
except
RollbackToSavePoint('INFONET');
end;

Dejan Likar
 
If the TOracleDataSet executes a Commit, then the rollback will fail (even the savepoint is gone).

If you cannot use CachedUpdates, then maybe you can use the CommitOnPost property to prevent commits for every post? Note that if a transaction fails, you will need to refresh the datasets.

------------------
Marco Kalter
Allround Automations
 
Back
Top