Return the name component of the current remote procedure call’s designation.
CS_CHAR *srv_rpcname(spp, lenp)
SRV_PROC *spp; CS_INT *lenp;
A pointer to an internal thread control structure.
A pointer to the buffer that will contain the length of the RPC name. lenp can be NULL, in which case the length of the RPC name is not returned.
Returns |
To indicate |
---|---|
A pointer to the null terminated name component of the current RPC’s designation. |
The location of the database component of the current RPC’s designation. |
A null pointer |
There is no current RPC. Open Server sets lenp to -1 and raises an informational error. |
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE ex_srv_rpcname PROTOTYPE((
SRV_PROC *sp,
CS_CHAR *buf,
CS_INT buflen,
CS_INT *lenp
));
/*
** EX_SRV_RPCNAME
**
** This routine demonstrates how to use srv_rrpcname to obtain
** the name of the remote procedure call received by this
** thread.
**
** Arguments:
** sp A pointer to an internal thread control
** structure.
** buf The address of the buffer in which the RPC
** name will be returned.
** buflen The size of the name buffer.
** lenp The address of an integer variable, which
** will be set to the length of the name
** returned.
**
** Returns
** CS_SUCCEED If the RPC name is returned.
** CS_FAIL If an error occurred.
*/
CS_RETCODE ex_srv_rpcname(sp, buf, buflen, lenp)
SRV_PROC *sp;
CS_CHAR *buf;
CS_INT buflen;
CS_INT *lenp;
{
CS_CHAR *np; /* The procedure name pointer. */
/*
** Initialization.
*/
np = (CS_CHAR *)NULL;
*lenp = (CS_INT)0;
/*
** Get the procedure name.
*/
np = srv_rpcname(sp, lenp);
if( np == (CS_CHAR *)NULL )
{
/*
** An error was al&ready raised.
*/
return CS_FAIL;
}
/*
** Copy the RPC name to the output buffer.
*/
(void)strncpy(buf, np, buflen);
/*
** All done.
*/
return CS_SUCCEED;
}
srv_rpcname returns a CS_CHAR pointer to a null terminated string containing the name component of the current remote procedure call (“RPC”) designation.
srv_rpcname returns only the RPC name and does not include anything else, such as optional specifiers for database, owner, or RPC number. For example, a fully qualified object name for an RPC in the Adaptive Server Enterprise is database.owner.rpcname;number. To get the other parts of the RPC’s designation, if any, use srv_rpcdb, srv_rpcowner, and srv_rpcnumber.
A user can determine whether an RPC exists by calling srv_rpcname. If the RPC does not exist, Open Server will return a SRV_ENORPC error. A user can code his or her error handler to ignore this error if detected.
srv_numparams, srv_rpcdb, srv_rpcnumber, srv_rpcoptions, srv_rpcowner