build_xact_string

Builds a name for a distributed transaction.

Syntax

void build_xact_string (
LPCSTR
xact_name,
LPCSTR
service_name,
DBINT
commid,
LPSTR
result );

where

xact_name
Is the application or username for the transaction. This name is encoded in the name string, but it is not used by the commit service or SQL Server. It identifies the transaction for debugging.
service_name
Is the name through which SQL Server contacts the commit service. You must supply a name for this parameter.
commid
Is the number used by the commit service to identify the transaction. The commid is the number returned by the call to start_xact.
result
Is the address of the buffer where the string should be built. The space must be allocated by the caller.

Remarks

This function builds a name string for use in the BEGIN TRANSACTION and PREPARE TRANSACTION statements in the SQL Server transaction. If SQL Server has to recover the transaction, it uses information encoded in the name to determine which commit service to contact and which transaction in that service to inquire about. The application should execute a Transact-SQL BEGIN TRANSACTION statement, using the string built by build_xact_string.

See Also

commit_xact, start_xact