Share this page

# Example: lr.start_sub_transaction and lr.end_sub_transaction

## Example 1

In the following example,lr.start_sub_transaction and lr.end_sub_transaction create a transaction that performs purchases of six electrical items. The parent transaction is purchases and the sub-transaction is electrical_purchases.

    lr.start_transaction("purchases");

    /* Breakdown the transaction into a smaller transaction */
    lr.start_sub_transaction("electrical_purchases", "purchases");

    /* call to Server API */
    int status = purchase_electrical_items(6);

    /* End transaction with operation result - pass or fail */
    if (status == 0)
        lr.end_sub_transaction("electrical_purchases", lr.PASS);
    else
        lr.end_sub_transaction("electrical_purchases", lr.FAIL);
    lr.end_transaction("purchases", lr.AUTO);

Tips to improve your search results... VuGen Function Reference Version 25.1-25.3 Function Reference 25.1-25.3 All View Local Help Center View Online Help Center Version: