OpenAPI User Guide > OpenAPI User Guide > OpenAPI Function Reference > OpenAPI Functions > IIapi_xaPrepare() Function--Prepare an XA transaction for Two-Phase Commit
Was this helpful?
IIapi_xaPrepare() Function--Prepare an XA transaction for Two-Phase Commit
The IIapi_xaPrepare() function prepares to commit an XA transaction started with IIapi_xaStart(). The association between the transaction and a connection must have been dropped using IIapi_xaEnd(). The transaction state of the connection used to prepare the XA transaction is not affected. The connection handle does not need to be the same as was originally associated with the XA transaction when started by IIapi_xaStart().
IIapi_xaPrepare() secures resources for a transaction in a two-phase commit situation. When IIapi_xaPrepare() completes successfully, the server has allocated and secured all resources to commit the transaction. The application can then call IIapi_xaCommit() to commit the transaction or IIapi_xaRollback() to abort the transaction.
This function has the following syntax:
II_VOID IIapi_xaPrepare( IIAPI_XAPREPPARM *prepParm );
 
typedef struct _IIAPI_XAPREPPARM
{
        IIAPI_GENPARM           xp_genParm;
        II_PTR                  xp_connHandle;
        IIAPI_TRAN_ID           xp_tranID;
        II_ULONG                xp_flags;
} IIAPI_XAPREPPARM;
This function has the following parameters:
xp_genParm
Type: input and delayed output
Specifies the generic parameters (see Generic Parameters).
xp_connHandle
Type: input
Specifies the connection handle identifying the connection to be used to prepare the XA transaction.
xp_tranID
Type: input
Specifies the XA transaction ID of the transaction which is to be prepared.
xp_flags
Type: input
Specifies optional transaction flags. Currently, no additional flags are defined. This parameter should be set to 0.
Last modified date: 01/30/2023