Begin_Transaction

See Also: Transactions and DDOs, Abort_Transaction, End_Transaction, Lock, Unlock, DF_TRANABORT_ONERROR, DF_TRANSACTION_ABORT

Purpose

To explicitly mark the beginning of a database transaction.

Syntax

Begin_Transaction

What It Does

This command is used to mark the beginning of a database transaction. In case of a rollback, the entire transaction is rolled back. A side effect of the Begin_Transaction command is to execute a Lock command.

Example

Begin_Transaction 

    Reread

    Move "Data Access Corporation" To vendor.name

    Save vendor

    Save invheader

    Move FALSE To bTransOK

 

    For iCount From 1 To 3

        Move iCount To invitems.linenumber

        Save invitems

        // if any item is DataFlex, this is a good transaction 

        If (invitems.name Contains "DataFlex");

            Move TRUE To bTransOK

    Loop

 

    If bTransOK;

        Unlock

    Else;           // Only allow the transaction if DataFlex is purchased.

        Abort_Transaction

 

    // The next line has no effect if the transaction is aborted.

End_Transaction 

Notes

 

Begin_Transaction

If (bTest) Begin

… 

End_Transaction 

End