lrt_tx_set_transaction_control

Transaction Handling Functions

Sets the transaction_control characteristics.

int lrt_tx_set_transaction_control( TRANSACTION_CONTROL control );

control Value for the transaction control characteristic. Valid values:
TX_UNCHAINED - indicates that lrt_tx_commit and lrt_tx_rollback should not start a new transaction before returning to their caller
TX_CHAINED - indicates that lrt_tx_commit and lrt_tx_rollback should start a new transaction before returning to their caller

The lrt_tx_set_transaction_controlfunction sets the transaction_control characteristics to the value specified in control.

Return Values

If the function succeeds, it returns a non-negative value, TX_OK. If it fails, it doesn't modify the value of TRANSACTION_CONTROL and it returns a negative value.

Parameterization

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

Example

In the following example, the lrt_tx_set_transaction_control function sets the transaction control to unchained mode.

Copy code
TXINFO txinfo;
lrt_tx_open(); // open resource managers
lrt_tx_set_transaction_timeout(30); // 30 second transaction timeout
lrt_tx_begin();     // start transaction
lrt_tx_set_commit_return(TX_COMMIT_COMPLETED);                                                                        
// 2-phase commit
lrt_tx_set_transaction_control(TX_UNCHAINED); // unchained transaction mode
lrt_tx_commit();                                    
// commit transaction
lrt_tx_begin();                                    
// start another transaction
lrt_tx_info(&txinfo);
lrt_tx_rollback();                                    
// abort it
lrt_tx_close();                                    
// close resource managers