xaStart method

XaTransactionHandle? xaStart(
  1. int connectionId,
  2. Xid xid
)
inherited

xa_start: open a new XA branch on connectionId with the given xid. Returns a live XaTransactionHandle in the XaState.active state on success, null on failure (call getStructuredError to inspect the cause).

Drive Phase 2 with XaTransactionHandle.end → XaTransactionHandle.prepare → XaTransactionHandle.commitPrepared or XaTransactionHandle.rollbackPrepared. Single-RM callers can use the XaTransactionHandle.commitOnePhase shortcut.

Implementation

XaTransactionHandle? xaStart(int connectionId, Xid xid) {
  final xaId = _native.xaStart(
    connectionId: connectionId,
    formatId: xid.formatId,
    gtrid: xid.gtrid,
    bqual: xid.bqual,
  );
  if (xaId == 0) return null;
  return createNativeXaTransactionHandle(
    xaId: xaId,
    xid: xid,
    conn: _connection,
  );
}