示例#1
0
        /*
        ** Name: xa_start   -  Start/Resume binding a thread w/an XID.
        **
        ** Description:
        **
        ** Inputs:
        **      xid        - pointer to XID.
        **      rmid       - RMI identifier, assigned by the TP system, unique to the AS
        **                   process.
        **      flags      - TP system-specified flags, one of
        **                       TMJOIN/TMRESUME/TMNOWAIT/TMASYNC/TMNOFLAGS.
        **
        ** Outputs:
        **	Returns:
        **          XA_OK          - normal execution.
        **          XA_RETRY       - if TMNOWAIT is set in flags. We will *always*
        **                           assume a blocking call and return this (Ingres65).
        **          XA_RB*         - if this XID is marked "rollback only".
        **             XA_RBROLLBACK - rollback only, unspecified reason.
        **             XA_RBCOMMFAIL - on any error on a GCA call.
        **             XA_RBDEADLOCK - deadlock detected down in DBMS server.
        **             XA_RBINTEGRITY- integrity violation detected in DBMS server.
        **             XA_RBOTHER    - any other reason for rollback.
        **             XA_RBPROTO    - protocol error, this XA call made in wrong state
        **                             for the thread/RMI.
        **             XA_RBTIMEOUT  - the local xn bound to this XID timed out.
        **             XA_RBTRANSIENT- a transient error was detected by the DBMS svr.
        **          XAER_ASYNC     - if TMASYNC was specified. We don't support
        **                           TMASYNC (post-Ingres65 feature).
        **          XAER_RMERR     - internal error w/gca association mgmt.
        **          XAER_RMFAIL    - RMI made unavailable by some error.
        **          XAER_DUPID     - XID already exists, when it's not expected to be
        **                           "known" at this AS, i.e. it's not TMRESUME/TMJOIN.
        **          XAER_OUTSIDE   - RMI/thread is doing work "outside" of global xns.
        **          XAER_NOTA      - TMRESUME or TMJOIN was set, and XID not "known".
        **          XAER_INVAL     - illegal input arguments.
        **          XAER_PROTO     - if there are active/suspended XIDs bound to
        **                           the RMI. Enforces XA Spec's "state table" rules.
        **
        ** History:
        **	18-Aug-03 (thoda04)
        **	    Created.  Rich description copied from front/embed/libqxa.
        */
        /// <summary>
        /// Start work on behalf of a transaction branch.
        /// </summary>
        /// <param name="xid">XID to perform the work on.</param>
        /// <param name="rmid">An integer, assigned by the transaction manager,
        /// uniquely identifies the called resource manager within the thread
        /// of control.</param>
        /// <param name="flags"></param>
        /// <returns>XA_OK for normal execution or an XAER* error code.</returns>
        public int xa_start(
			AdvanXID xid,
			int rmid,
			long flags)
        {
            if (xid == null)
            {
                trace.write("xa_start: xid = <null>"+
                    ", rmid = " + rmid.ToString());
                return XAER_INVAL;  // invalid arguments were specified
            }

            if (trace.enabled(3))
            {
                trace.write("xa_start: xid = " + xid.ToString() +
                    ", rmid = " + rmid.ToString() +
                    ", flags = " + XAFlagsToString(flags));
            }

            return XAER_PROTO;  // unexpected context
        }
示例#2
0
        /*
        ** Name: xa_rollback   -  Propagate rollback of a local xn bound to an XID.
        **
        ** Description:
        **
        ** Inputs:
        **      xid        - pointer to XID.
        **      rmid       - RMI identifier, assigned by the TP system, unique to the
        **                   AS process w/which LIBQXA is linked in.
        **      flags      - TP system-specified flags, one of TMASYNC/TMNOFLAGS.
        **
        ** Outputs:
        **	Returns:
        **          XA_OK          - normal execution.
        **          XA_RB*         - if this XID is marked "rollback only".
        **             XA_RBROLLBACK - rollback only, unspecified reason.
        **             XA_RBCOMMFAIL - on any error on a GCA call.
        **             XA_RBDEADLOCK - deadlock detected down in DBMS server.
        **             XA_RBINTEGRITY- integrity violation detected in DBMS server.
        **             XA_RBOTHER    - any other reason for rollback.
        **             XA_RBPROTO    - protocol error, this XA call made in wrong state
        **                             for the thread/RMI.
        **             XA_RBTIMEOUT  - the local xn bound to this XID timed out.
        **             XA_RBTRANSIENT- a transient error was detected by the DBMS
        **                             server.
        **          XAER_ASYNC     - if TMASYNC was specified. We don't support
        **                           TMASYNC (Ingres65).
        **          XAER_RMERR     - internal error w/gca association mgmt.
        **          XAER_RMFAIL    - RMI made unavailable by some error.
        **          XAER_NOTA      - TMRESUME or TMJOIN was set, and XID not "known".
        **          XAER_INVAL     - illegal arguments.
        **          XAER_PROTO     - if there are active/suspended XIDs bound to
        **                           the RMI. Enforces XA Spec's "state table" rules.
        **
        **          UNSUPPORTED in Ingres65
        **          -----------------------
        **
        **          XA_HEURHAZ     - Work done in global xn branch may have been
        **                           heuristically completed.
        **          XA_HEURCOM     - Work done may have been heuristically committed.
        **          XA_HEURRB      - Work done was heuristically rolled back.
        **          XA_HEURMIX     - Work done was partially committed and partially
        **                           rolled back heuristically.
        **
        ** History:
        **	18-Aug-03 (thoda04)
        **	    Created.  Rich description copied from front/embed/libqxa.
        */
        /// <summary>
        /// Roll back the work on behalf of a transaction branch.
        /// </summary>
        /// <param name="xid">XID to perform the work on.</param>
        /// <param name="rmid">An integer, assigned by the transaction manager,
        /// uniquely identifies the called resource manager within the thread
        /// of control.</param>
        /// <param name="flags"></param>
        /// <returns>XA_OK for normal execution or an XAER* error code.</returns>
        public int xa_rollback(
			AdvanXID xid,
			int rmid,
			long flags)
        {
            if (xid == null)
            {
                trace.write("xa_rollback: xid = <null>"+
                    ", rmid = " + rmid.ToString());
                return XAER_INVAL;  // invalid arguments were specified
            }

            if (trace.enabled(3))
            {
                trace.write("xa_rollback: xid = " + xid.ToString() +
                    ", rmid = " + rmid.ToString() +
                    ", flags = " + XAFlagsToString(flags));
            }

            int rc = xa_commit_or_rollback(false, xid, rmid, flags);
            return rc;
        }