company logo

DBObjectHandle :: BeginTransaction - Start transaction

When starting a transaction all modification for the database are stored in a transaction buffer. A transaction can start as an internal or external transaction.

Internal transactions are used for small transactions up to 10000 updated database entries. Usually a small transaction takes just a few seconds. By defining a maximum buffer count for the transaction one may define a dynamical transaction buffer for speeding up processes as copying data. In this case the transaction buffer will be cleared automatically when the buffer limit is reached.

External transactions are stored in a transaction database which is created in a path defined in the TABASE system variable (or ini-file variable). External transactions are a little bit slower than internal ones but they are not limited in capacity.

Transactions can be nested. When starting a transaction while another transaction is running the new transaction creates a transaction within a transaction. The nesting level (>0) is returned as transaction level. When the function returns 0 the transaction could not be started.

Entries, which are stored in a transaction are locked for other users until the top transaction has been terminated.

Updates can be moved to the upper transaction or stored in the database using CommitTransaction(). Only committing the top transaction will store the updates to the database. Updates made within a transaction become visible in an upper transaction when the transaction is closed. They become visible for other users when the top transaction is closed (CommitTransaction()).

RollBack() can be used to undo all updates made within a transaction.

Return value:  Transaction level ( int16  )

The transaction level is usually 1.For nested transaction it corresponds to the nesting level.

Implementation details

int16 DBObjectHandle  :: BeginTransaction ( logical ext_TA=NO, int32 w_maxnum=AUTO )
  • ext_TA - External transaction

    YES must be passed to start the transaction as external transaction, i.e. all modification are stored to an external transaction base. Otherwise (NO) the transaction is started as internal transaction, i.e. the modifications are stored in memory.

    Default: NO
  • w_maxnum - Maximum number of entries in transaction (buffer size) Default: AUTO