When am I entering/leaving a transaction?

jpickup

Member²
I am trying to create similar behaviour to that of the Commit & Rollback buttons found in PL/SQL Developer. i.e. Buttons enabled when in a transaction.

The TOracleSession component has a method InTransaction which tells me if I'm currently in a transaction but I can't find a way of determining when this has changed (short of polling it with a timer).

The situation seems to call out for two events on the TOracleSession component, e.g.: OnStartTransaction, OnEndTransaction or even just a single OnChangeInTransaction event.

Am I missing something?
 
The InTransaction function goes to the database server to check if a transaction is opened. In other words, the event you are looking for is rather difficult to implement without generating a network rountrip for every SQL statement, procedure call, method call, and LOB activity.

Calling InTransaction on a timer-based event is indeed one possibilty to achieve what you are looking for. Another possibility is to call InTransaction on appropriate points in your application. This is what PL/SQL Developer does.

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