Subject Re: [firebird-support] Re: Transactions and dbExpress
Author Martijn Tonies
Hello Christian,

> > Any INSERT/etc will use auto-commit by default, unless a
> > transaction has been started.
> >
> > Any new statement will use the last started transaction, unless you
> > explicitly tell it to use another.
>
> The more I look at SqlExpr.pas, the more I think, this is not a
> programming highlight (...).

Well, it's ... different. :-) ... At least you can start multiple
transactions!

> So if I don't start a transaction myself, then you start one in the
> driver and I have no control, over this transaction through dbExpress?

If you don't start a transaction, the transaction isolation from
TSQLConnection.Params is used and it's auto-commit.

> And how can I set the transaction for a TSQLDataSet ?

Through the TransactionLevel property:

Indicates the transaction to which this dataset belongs.

Delphi syntax:

property TransactionLevel: SmallInt;

C++ syntax:

__property short int TransactionLevel = {read
=FTransactionLevelObject, write
=FTransactionLevel, default=0};

Description

Use TransactionLevel to indicate the active transaction to use when opening
this dataset or using it to execute commands. TransactionLevel is the same
as the transaction identifier that is supplied to the connection's
StartTransaction method. If TransactionLevel is unspecified (0), the dataset
fetches its records or executes commands in the context of the most recently
started transaction.

Note: Most applications do not need to use TransactionLevel because most
database servers require that SQL commands belong to the most recently
started transaction. However, the InterBase server allows multiple
overlapping transactions to be active simultaneously.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com