lr_set_transaction_status

Sets the default end status of open transactions.

int lr_set_transaction_status( int status);
Alphabetical Listing - C Language Utility Functions

Arguments

NameComments
status One of the Transaction Status constants for pass, fail, or stop. The auto status is not applicable.

The lr_set_transaction_status function sets the status of those transactions currently open which have LR_AUTO in their lr_end_transaction statement.

A transaction's status is defined in the status parameter of lr_end_transaction. If this status is LR_AUTO, the value is automatically assigned. By default, this value is LR_PASS, signifying a successful transaction. lr_set_transaction_status changes this default value to status.

Return Values

This function returns 0 on success and a negative value on failure.

Parameterization

Parameterization is not applicable to this function.

Example

In the following example, the status of transaction t1 is changed to a fail status because a general error has occurred. Note that the exit status of transaction t2 which is not defined as LR_AUTO is unaffected by the call to lr_set_transaction_status and it remains as LR_PASS.

if (event == GENERAL_ERROR)
    lr_set_transaction_status(LR_FAIL);

lr_end_transaction("t1", LR_AUTO);
lr_end_transaction("t2", LR_PASS);