UniDAC

TUniConnection.StartTransaction Method

Call the StartTransaction method to begin a new transaction at the server.

Class

TUniConnection

Syntax

procedure StartTransaction; overload; override;

Remarks

Call the StartTransaction method to begin a new transaction at the server. Before calling StartTransaction, an application should check the value of the TCustomDAConnection.InTransaction property. If the result is True, it means that a transaction is already in progress, a subsequent call to StartTransaction without first calling TCustomDAConnection.Commit or TCustomDAConnection.Rollback to end the current transaction raises Exception. Calling StartTransaction when connection is closed also raises Exception.

Updates, insertions, and deletions that take place after a call to StartTransaction are held by the server until an application calls Commit to save the changes or Rollback to cancel them.

Use the IsolationLevel property to specify how transactions containing database modifications are handled.

Values of the TCRIsolationLevel enumeration correspond to the following isolation levels of supported database servers:
SQL standard Oracle SQL Server MySQL InterBase/Firebird
ilReadCommitted ReadCommitted ilReadCommitted ilReadCommitted ilReadCommitted iblReadCommitted
ilReadUnCommitted ReadUnCommitted - ilReadUnCommitted ilReadUnCommitted -
ilRepeatableRead RepeatableRead - ilRepeatableRead ilRepeatableRead -
ilIsolated Serializable - ilIsolated ilSerializable iblTableStability
ilSnapshot Serializable without locks ilSerializable ilSnapshot - iblSnapshot
ilCustom This value is introduced for future needs. Currently not implemented.

The ReadOnly parameter determines that a read-only transaction will be started. It means that data within the transaction can not be modified. You will get an exception on attempt to post any changes.

The ReadOnly parameter has sense only for Oracle and InterBase providers.

See Also

© 1997-2020 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback