srv_getbindtoken (Extended Stored Procedure API)
Importante: |
---|
Questa funzionalità verrà rimossa in una delle prossime versioni di Microsoft SQL Server. Non utilizzare questa funzionalità in un nuovo progetto di sviluppo e modificare appena possibile le applicazioni in cui questa funzionalità viene utilizzata. Use CLR integration instead. |
Obtains a bind token of the transaction in the current client session that invokes the extended stored procedure.
The extended stored procedure can then use sp_bindsession to bind any new session it creates against the same server to the existing transaction so that the new session can share the same transaction lock space with the client session that invoked the extended stored procedure.
Sintassi
int srv_getbindtoken (
SRV_PROC*
srvproc
,
char*
bindtoken
);
Arguments
- srvproc
Is a pointer to the SRV_PROC structure that is the handle for a particular client connection. The structure contains all the information that the Extended Stored Procedure API library uses to manage communications and data between the application and the client.
- bindtoken
Is a pointer to a buffer where the bind token will be copied. The bind token is represented as a null-terminated string. The buffer you specify should be at least 255 bytes in length.
Returns
SUCCEED or FAIL.
Osservazioni
To bind an extended stored procedure session to the client session that called it so they share the same transaction lock space
The extended stored procedure calls svr_getbindtoken to get the bind token for the current transaction in the session. The token is returned in the given bindtoken parameter.
The extended stored procedure opens new session(s) against the same server. Inside that session, the extended stored procedure uses the bind token with sp_bindsession to bind the new session to the same transaction. The extended stored procedure can create multiple sessions and bind all the sessions to the same transaction.
A bound session is unbound when the external stored procedure returns or when sp_bindsession is called with an empty string.
[!NOTA] Only one bound session at a time can have access to a shared connection. If one session is currently executing a statement at the server or has results pending from the server, no other sessions sharing the same bound connection can gain access to the server until the current session has finished executing the current statement. If a session attempts to gain access to the connection while the server is busy, an error is returned to the conflicting session indicating the connection is in use and the session should retry later.
Nota sulla protezione: |
---|
You should thoroughly review the source code of extended stored procedures, and you should test the compiled DLLs before you install them on a production server. For information about security review and testing, see this Microsoft Web site. |
Vedere anche
Altre risorse
sp_bindsession (Transact-SQL)
sp_getbindtoken (Transact-SQL)