OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

tx_set_transaction_control - Set transaction_control characteristic

Format

ANSI C, C++

#include <tx.h>
int  tx_set_transaction_control (TRANSACTION_CONTROL control)

K&R C

#include <tx.h>
int  tx_set_transaction_control (control)
TRANSACTION_CONTROL control

Description

The function tx_set_transaction_control() sets the transaction_control characteristic to the value specified in control. This characteristic determines whether tx_commit() and tx_rollback() start a new transaction before returning to their caller.

The function tx_set_transaction_control() may be called regardless of whether the application program is in transaction mode. This setting remains in effect until changed by a subsequent call to tx_set_transaction_control().

The initial setting for this characteristic is TX_UNCHAINED.

<<Argument>>

<<control>>

The valid settings for control are as follows:

 
{TX_UNCHAINED|TX_CHAINED}
 

Return value

<<When return value is 0>>
Upon successful completion, tx_set_transaction_control() returns TX_OK, a non-negative return value. <<The transaction_control characteristic was set to the value of control.>>

Errors

Under the following conditions, tx_set_transaction_control() does not change the setting of the transaction_control characteristic and returns one of these negative values.

Return value Return value (numeric) Explanation
TX_EINVAL -8 The value set for control is neither TX_UNCHAINED nor TX_UNCHAINED.
TX_PROTOCOL_ERROR -5 The function was called in an improper context (for example, the caller has not yet called tx_open()).
TX_FAIL -7 The transaction manager encountered a fatal error. The nature of the error is such that the transaction manager can no longer perform work on behalf of the application.

See also

tx_begin(), tx_commit(), tx_open(), tx_rollback(), tx_info().

<<Example>>

<<if (tx_set_transaction_return (TX_UNCHAINED) == 0 &&
                                                tx_commit() < 0 )
  fputs ("cannot commit transaction\n", stderr);>>

<<Note on use with OpenTP1>>

  1. <<tx_set_transaction_control() cannot be used along with the functions dc_trn_~().>>