Transactions and commiting

umayr

Member²
Marco,
I see that you recommend explicit commiting of transactions.

If you can pls help me here

a) Where do I commit, in case of a Toracledataset and fields in a form, controlled by an OracleNavigator.

b) If I call a procedure/function would it be better if
. I do not include any commits/rollbacks in the procedure itself
. I use it in the Delphi Try exception block.

Thanks in advance
UShafeeu
 
a)
When posting records through a TOracleDataSet, transaction management depend on the CachedUpdates and CommitOnPost properties. By default, each posted record is implicitly committed by the dataset. If CachedUpdates is True, records are applied to the database through TOracleSession.ApplyUpdates, which also implicitly controls the transaction (though you have some flexibility here). If CommitOnPost is False, you need to commit or rollback the posted records. This last option can only be used in specific situations, because a rollback will leave the dataset in an inconsistent state (until you refresh it).

b)
That depends on the procedure. If you foresee that it can be used as part of a larger transaction, then you should not perform the commit inside the procedure. This is generally good practice.

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