FireDAC.Comp.Client.TFDCustomConnection.StartTransaction

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure StartTransaction;

C++

void __fastcall StartTransaction(void);

Properties

Type Visibility Source Unit Parent
procedure
function
public
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDCustomConnection

Description

Starts a new database transaction.

Call StartTransaction to start a new DBMS transaction. 

FireDAC supports nested transactions. If the DBMS does not support nested transactions, then FireDAC emulates them using savepoints. If the transaction is already active, then FireDAC will place a savepoint, otherwise it will start a new transaction. Use TxOptions.EnableNested to enable or disable nested transactions. 

Before calling StartTransaction, an application can adjust the settings of the TxOptions property as desired. Adjusting options after the transaction is started does not affect the current transaction. 

All data modifications, such as those caused by the INSERT, UPDATE, or DELETE command, made after a call of StartTransaction, can be either confirmed by calling Commit, or undone by calling Rollback

Some DBMSs will fail to start the transaction if there are active result sets, for example, MS SQL Server 2005. 

The StartTransaction call is the shortcut to Transaction.StartTransaction, if the Transaction property is assigned. Otherwise StartTransaction will operate on the default connection transaction.

See Also

Samples