次の方法で共有


IDtcToXaMapper::TranslateTridToXid

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

This method is called to obtain an XID from an ITransaction interface pointer. The ODBC driver calls this method each time a connection is enlisted on a new transaction. The ITransaction pointer is offered by a transaction object. The transaction object contains a DTC transaction that is identified by a transaction identifier (TRID) which is a globally unique identifier (GUID). Given a TRID, one can always create an XID.

The XID should be stored in the connection object as it may be needed in the future. After obtaining the XID, the ODBC driver should issue an xa_start or its equivalent on the back-end resource manager to associate the XID with the connection.

Syntax

  
HRESULT TranslateTridToXid(   DWORD * pdwITransaction,  DWORD dwRMCookie,  XID * pXid);  

Parameters

pdwITransaction
[in] A pointer to ITransaction object which the application passes in as a value for the SQL_ENLIST_IN_DTC connection attribute.

dwRMCookie
[in] A cookie representing the RM which was obtained from the call to RequestNewResourceManager.

pXid
[in/out] A pointer to the caller allocated XID structure.

#define XIDDATASIZE  128 /* size in bytes */  
typedef struct xid_t {  
  LONG     formatID;  
  LONG     gtrid_length;  
  LONG     bqual_length;  
  CHAR     data[XIDDATASIZE];  
} XID;  

Return Values

S_OK
Success.

E_INVALIDARG
One or more of the parameters are not valid.

XACT_E_NOTRANSACTION
No transaction corresponding to pdwITransaction.

Requirements

For an explanation of the requirement values, see Requirements (Component Services).

Platforms: Windows Server 2016, Windows 10, Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista

Header: Declared in oletx2xa.h

See Also

IDtcToXaHelperFactory
IDtcToXaHelper
IDtcToXaHelperSinglePipe