Data.SqlExpr.TSQLConnection.BeginTransaction

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function  BeginTransaction: TDBXTransaction; overload;
function  BeginTransaction(Isolation: TDBXIsolation): TDBXTransaction; overload;

C++

Data::Dbxcommon::TDBXTransaction* __fastcall BeginTransaction()/* overload */;
Data::Dbxcommon::TDBXTransaction* __fastcall BeginTransaction(int Isolation)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
Data.SqlExpr.pas
Data.SqlExpr.hpp
Data.SqlExpr TSQLConnection

Description

Initiates a new transaction in the associated database.

Call BeginTransaction to start a new transaction against a database server that supports transactions. (MySQL servers support transactions but not multiple transactions on one connection.) You can check the TransactionsSupported property to determine whether the server supports transactions. If the server does not support transactions, BeginTransaction does nothing.

The method returns a TDBXTransaction instance.

If the transaction is successfully started, BeginTransaction sets the InTransaction property to True.

Updates, insertions, and deletions that take place after a call to BeginTransaction are enlisted in that transaction until another overlapping transaction is started or until the application calls CommitFreeAndNil to save the changes, or RollbackFreeAndNil to cancel them.

Tip: If the server does not support multiple transactions, check the status of the InTransaction property to be sure that another transaction is not already in progress.

Tip: When working with overlapped transactions, you can indicate how simultaneous transactions interact when they work on the same tables by setting the IsolationLevel parameter of the TSQLConnection.

See Also