DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info) xa-statements

Info Catalog (mysql.info) xa (mysql.info) xa (mysql.info) xa-states
 
 13.4.7.1 XA Transaction SQL Syntax
 ..................................
 
 To perform XA transactions in MySQL, use the following statements:
 
      XA {START|BEGIN} XID [JOIN|RESUME]
 
      XA END XID [SUSPEND [FOR MIGRATE]]
 
      XA PREPARE XID
 
      XA COMMIT XID [ONE PHASE]
 
      XA ROLLBACK XID
 
      XA RECOVER
 
 For `XA START', the `JOIN' and `RESUME' clauses are not supported.
 
 For `XA END' the `SUSPEND [FOR MIGRATE]' clause is not supported.
 
 Each XA statement begins with the `XA' keyword, and most of them
 require an XID value. An XID is an XA transaction identifier. It
 indicates which transaction the statement applies to. XID values are
 supplied by the client, or generated by the MySQL server. An XID value
 has from one to three parts:
 
      XID: GTRID [, BQUAL [, FORMATID ]]
 
 GTRID is a global transaction identifier, BQUAL is a branch qualifier,
 and FORMATID is a number that identifies the format used by the GTRID
 and BQUAL values. As indicated by the syntax, BQUAL and FORMATID are
 optional. The default BQUAL value is `''' if not given. The default
 FORMATID value is 1 if not given.
 
 GTRID and BQUAL must be string literals, each up to 64 bytes (not
 characters) long.  GTRID and BQUAL can be specified in several ways.
 You can use a quoted string (`'ab''), hex string (`0x6162', `X'ab''),
 or bit value (`b'NNNN'').
 
 FORMATID is an unsigned integer.
 
 The GTRID and BQUAL values are interpreted in bytes by the MySQL
 server's underlying XA support routines.  However, while an SQL
 statement containing an XA statement is being parsed, the server works
 with some specific character set. To be safe, write GTRID and BQUAL as
 hex strings.
 
 XID values typically are generated by the Transaction Manager. Values
 generated by one TM must be different from values generated by other
 TMs. A given TM must be able to recognize its own XID values in a list
 of values returned by the `XA RECOVER' statement.
 
 `XA START XID' starts an XA transaction with the given XID value. Each
 XA transaction must have a unique XID value, so the value must not
 currently be used by another XA transaction.  Uniqueness is assessed
 using the GTRID and BQUAL values. All following XA statements for the
 XA transaction must be specified using the same XID value as that given
 in the `XA START' statement. If you use any of those statements but
 specify an XID value that does not correspond to some existing XA
 transaction, an error occurs.
 
 One or more XA transactions can be part of the same global transaction.
 All XA transactions within a given global transaction must use the same
 GTRID value in the XID value. For this reason, GTRID values must be
 globally unique so that there is no ambiguity about which global
 transaction a given XA transaction is part of. The BQUAL part of the
 XID value must be different for each XA transaction within a global
 transaction. (The requirement that BQUAL values be different is a
 limitation of the current MySQL XA implementation. It is not part of
 the XA specification.)
 
 The `XA RECOVER' statement returns information for those XA
 transactions on the MySQL server that are in the `PREPARED' state. (See
  xa-states.) The output includes a row for each such XA
 transaction on the server, regardless of which client started it.
 
 `XA RECOVER' output rows look like this (for an example XID value
 consisting of the parts `'abc'', `'def'', and `7'):
 
      mysql> XA RECOVER;
      +----------+--------------+--------------+--------+
      | formatID | gtrid_length | bqual_length | data   |
      +----------+--------------+--------------+--------+
      |        7 |            3 |            3 | abcdef |
      +----------+--------------+--------------+--------+
 
 The output columns have the following meanings:
 
    * `formatID' is the FORMATID part of the transaction XID
 
    * `gtrid_length' is the length in bytes of the GTRID part of the XID
 
    * `bqual_length' is the length in bytes of the BQUAL part of the XID
 
    * `data' is the concatenation of the GTRID and BQUAL parts of the XID
 
Info Catalog (mysql.info) xa (mysql.info) xa (mysql.info) xa-states
automatically generated byinfo2html