Skip to content

DF_TRANSACTION_ABORT

See Also: Get_Attribute, Set_Attribute, Begin_Transaction, End_Transaction, Abort_Transaction, Lock, Reread, Unlock

Indicates whether the last transaction was aborted.

Level

Global

Type

Boolean, temporary

Access

Read only

Values

  • True
  • False

Remarks

The attribute indicates whether the last transaction was aborted.

DataFlex supports two types of transactions: Explicit and Implicit. An implicit transaction is a transaction that is started via the Lock or Reread command and ended via the Unlock command. An explicit transaction is started by the Begin_Transaction command and ended by the End_Transaction command.

Any error condition inside of an explicit transaction forces the transaction to be rolled back, thus setting the DF_TRANSACTION_ABORT attribute to true. An error condition in an implicit transaction only forces the transaction to be rolled back if DF_TRANABORT_ONERROR (see DF_TRANABORT_ONERROR_Attribute) is set to true. If that is the case, the DF_TRANSACTION_ABORT attribute is set to true.

Procedure ShowUncommitted
    Handle hTable
    Boolean bCommitted
    Boolean bAborted
    String sTable

    Get_Attribute DF_TRANSACTION_ABORT To bAborted
    If (bAborted) Begin
        Showln "Tables that are uncommitted are:"
        Move 0 To hTable
        Repeat
            Get_Attribute DF_FILE_NEXT_OPENED Of hTable To hTable
            If (hTable > 0) Begin
                Get_Attribute DF_FILE_COMMITTED Of hTable To bCommitted
                If (Not(bCommitted)) Begin
                    Get_Attribute DF_FILE_LOGICAL_NAME Of hTable To sTable
                    Showln "    " sTable
                End
            End
        Until (hTable = 0)
    End
End_Procedure // ShowUncommitted

The sample procedure above checks if the last transaction was successful and shows a list of tables that have not been committed.