Utility Functions and C Language Reference > Utility Functions: Java (lr.) > Alphabetical Listing > lr_end_transaction


Marks the end of a transaction.

C Language

int lr_end_transaction( char *transaction_name, int status) ;
Example: lr_end_transaction Transaction Functions

Java Language

int lr.end_transaction( String transaction_name, int status); 
Example: lr.end_transaction Transaction Functions Java Syntax


Name Comments
transaction_name A string indicating the name of an existing transaction.
status The Transaction Status

The lr_end_transaction function marks the end of a transaction and records the amount of time it took to perform the transaction. To indicate a transaction to be analyzed, place the lr_start_transaction function before the transaction, and the lr_end_transaction function after the transaction.

You can manually set the status of the transaction or you can allow the script to detect it automatically. To manually set the status, you perform a manual check within the code of your script (see example) evaluating the return code of a function. For the "succeed" return code, set the status to LR_PASS. For a "fail" return code, set the status to LR_FAIL. For an "aborted" return code, set the status to LR_STOP.

If status is LR_AUTO, then the value of status is automatically assigned. By default, this value is LR_PASS signifying a successful transaction. However, if prior to lr_end_transaction, you change the default value using lr_set_transaction_status, lr_set_transaction_status_by_name, lr_set_transaction_instance_statusor lr_fail_trans_with_error, then this is the value which is passed as status in lr_end_transaction.

If you make a series of calls to functions that modify the LR_AUTO status, then it is the last call before lr_end_transaction which effectively changes the status.

Return Values

This function returns 0 if it succeeds. It returns -1 if the transaction name is illegal or if there is no prior call to lr_start_transaction with a transaction of the same name.


You cannot use standard parameterization for any arguments in this function.