TXNLEVEL( ) Function

JavaScript Editor js editor     Web development 



Main Page

Returns a numeric value indicating the current transaction level.

TXNLEVEL(В )

Return Value

Numeric

Remarks

Use BEGIN TRANSACTION to create a transaction. Transactions are nested by issuing BEGIN TRANSACTION when another transaction is in progress. Transactions can be nested in this manner to five levels. Use TXNLEVEL(В ) to determine the current transaction level.

TXNLEVEL(В ) returns a value from 0 to 5. TXNLEVEL(В ) returns 0 if a transaction is not in progress.

Example

In the following example, the customer table in the testdata database is opened. BEGIN TRANSACTION is issued to start a transaction, and TXNLEVEL(В ) is used to display the transaction level (1). BEGIN TRANSACTION is issued again to start a nested transaction, and TXNLEVEL(В ) displays 2 for the current transaction level.

В Copy Code
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE Customer     && Open customer table
CLEAR

BEGIN TRANSACTION
   tLevel = ALLTRIM(STR(TXNLEVEL()))
   =MESSAGEBOX("Current Transaction: " + tLevel, 0, "Trasaction Level")
   BEGIN TRANSACTION
      tLevel = ALLTRIM(STR(TXNLEVEL()))
      =MESSAGEBOX("Current Transaction: " + tLevel, 0, ;
         "Trasaction Level")
   END TRANSACTION
END TRANSACTION

See Also



JavaScript Editor js editor     Web development