OpenTP1 Version 7 Programming Reference C Language
tx_set_commit_return - Set commit_return characteristic
Format
ANSI C, C++
#include <tx.h> int tx_set_commit_return (COMMIT_RETURN when_return) |
K&R C
#include <tx.h> int tx_set_commit_return (when_return) COMMIT_RETURN when_return |
Description
The function tx_set_commit_return() sets the commit_return characteristic to the value specified in when_return. This characteristic affects the way tx_commit() behaves with respect to returning control to its caller.
tx_set_commit_return() may be called regardless of whether its caller is in transaction mode. This setting remains in effect until changed by a subsequent call to tx_set_commit_return().
The initial setting for this characteristic is implementation dependent <<in the case of OpenTP1, TX_COMMIT_COMPLETED.>>
<<Argument>>
<<when_return>>
The valid settings for when_return are as follows:
{TX_COMMIT_DECISION_LOGGED|TX_COMMIT_COMPLETED}
Return value
<<When return value is 0>>
Upon successful completion, tx_set_commit_return() returns TX_OK, a non-negative return value.
<<When return value is positive>>
If the transaction manager does not support the setting of when_return to TX_COMMIT_DECISION_LOGGED, it returns TX_NOT_SUPPORTED, a non-negative return value, and the commit_return characteristic remains set to its existing value. The transaction manager must support the setting of when_return to at least one of TX_COMMIT_COMPLETED or TX_COMMIT_DECISION_LOGGED. <<For OpenTP1, the return value is TX_COMMIT_RETURN.>>
Errors
Under the following conditions, tx_set_commit_return() does not change the setting of the commit_return characteristic and returns one of these negative values.
Return value | Return value (numeric) | Explanation |
---|---|---|
TX_EINVAL | -8 | The value set for when_return is neither TX_COMMIT_DECISION_LOGGED nor TX_COMMIT_COMPLETED. |
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_commit(), tx_open(), tx_info().
<<Example>>
<<if (tx_set_commit_return (TX_COMMIT_COMPLETED) == 0 && tx_commit() < 0 ) fputs ("cannot commit transaction\n", stderr);>> |
<<Note on use with OpenTP1>>
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.