lrt_tx_set_commit_return

Transaction Handling Functions

Sets the commit_return characteristic.

int lrt_tx_set_commit_return( COMMIT_RETURN when_return );

when_return Value that for the commit_return characteristic. Valid values:
TX_COMMIT_DECISION_LOGGED - indicates that lrt_tx_commit should return after the commit decision has been logged by the first phase of the two-phased commit protocol, but before the second phase has completed
TX_COMMIT_COMPLETED - indicates that lrt_tx_commit should return after the two-phase commit protocol has finished completely

The lrt_tx_set_commit_return function sets the commit_return characteristic to the value specified in when_return.

Return Values

If the function succeeds, it returns a non-negative value, TX_OK. If it fails, it doesn't modify the value of COMMIT_RETURN 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_commit_return function indicates that the commit should return after the two-phase commit has been completed.

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