gtpc2m9uC/C++ Language Support User's Guide

xa_commit-Commit Work Done for a Transaction Branch

The transaction manager (TM) calls the xa_commit function to commit work associated with the transaction branch. Any changes made to resources held during the transaction branch are made permanent.

Format

#include (i$tmcr.h)
int     xa_commit(XID *xid, int rmid, long flags);

xid
A pointer to an exchange identification (XID) structure. XID is a unique identifier assigned by the transaction manager for each transaction branch.

rmid
An integer, assigned by the TM, that can be used to uniquely identify the called resource manager instance.

flags

TMNOFLAGS
Used when no other flags are set.

Normal Return

XA_OK
Normal completion.

Error Return

XA_RBROLLBACK
The resource manager (RM) did not commit the work done for the transaction branch. The resource manager has rolled back the work of the branch and has released all held resources.

XAER_RMERR
An error occurred in committing the work performed for the transaction branch and the work of the branch has been rolled back. This error signals a catastrophic event to a transaction manager because other resource managers may successfully commit their work for this branch. This error is returned only when a resource manager concludes that it can never commit the branch and that it cannot hold the resource of the branch in a prepared state.

XAER_RMFAIL
An error occurred that makes the resource manager unavailable. The specified xid may or may not have been prepared.

XAER_NOTA
The specified XID is not known by the resource manager.

XAER_INVAL
Incorrect arguments were specified.

XAER_PROTO
The routine was called incorrectly.

Programming Considerations

Examples

#include (i$tmcr.h)
 
    if (xa_commit(XID *xid, int rmid, long flags) != XA_OK)
    {
        /* handle error condition */

  ·
  ·
  ·
} else { /* continue with normal processing */
  ·
  ·
  ·
}

Related Information