lr_set_transaction_status_by_name

Sets the default end status of a single transaction.

int lr_set_transaction_status_by_name (int status, const char *trans_name);
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.
trans_name The transaction name

The lr_set_transaction_status_by_name function sets the default status of the open transaction with name trans_name. This transaction's lr_end_transaction statement must use automatic status assignment by passing LR_AUTO as its status parameter.

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_by_name changes this default value to status.

See Transaction Status.

Return Values

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

Parameterization

All string arguments (char type) can be parameterized using standard parameterization.

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 is unaffected by this call to lr_set_transaction_status. Since the default value of LR_AUTO is LR_PASS, it will return a passed exit status.

if (event == GENERAL_ERROR)
    lr_set_transaction_status_by_name(LR_FAIL, "t1");

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