AutoCommit property

Applies to
TIB_Transaction

Declaration
Property AutoCommit : boolean;

Description
This property is an IBO behavioral property and does not map to any specific feature of the InterBase API.

It is used to provide a simpler interface when all changes should be made permanent as they occur.

This setting takes effect when a transaction is activated or closed.

When a transaction is physically activated a SavePoint is generated that will cause the transaction to go back to an inactive or active pending state. Thus, if AutoCommit is true then the status of the transaction will never get beyond tsActivePending unless StartTransaction is called which temporarily suspends AutoCommit behavior.

If Close is called then AutoCommit will cause a Commit to be used to end the transaction instead of a Rollback. If an exception is raised when committing a rollback is performed.

It is safe to use AutoCommit true with datasets that use PessimisticLocking. IBO does not perform a commit retaining when the DML to place the record lock is executed. However, once another dataset in the same transaction posts, a SavePoint will be generated which will clear the record lock such that another transactions with tiCommitted isolation or new transactions of any isolation will be able to alter the record. This is a point of risk.

Calling the StartTransaction method temporarily suspends the auto commit behavior until the logical transaction is ended. At that time the auto commit behavior will resume.

AutoCommit shouldn't be considered the mechanism that makes sure there are no long running transactions holding up garbage collection. The OAT advancement is not impacted by the setting of AutoCommit. The reason is because AutoCommit uses a SavePoint which maps to a call to isc_commit_retaining(). This does not cause the transaction to physically be ended in order to preserve existing cursors.

IBO automatically advances the OAT as best it can when tiCommitted isolation is used. So AutoCommit in that respect is automatic.