Return the database component of the current remote procedure designation.
CS_CHAR *srv_rpcdb(spp, lenp)
SRV_PROC *spp; CS_INT *lenp;
A pointer to an internal thread control structure.
A pointer to an int variable that will contain the length of the database name. lenp can be NULL, in which case the length of the database name is not returned.
Returns |
To indicate |
---|---|
A pointer to a null terminated string containing the database component of the current RPC’s designation. |
The location of the database component of the current RPC’s designation. |
(CS_CHAR *) NULL |
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_rpcdb PROTOTYPE((
SRV_PROC *spp,
CS_CHAR **dbp,
CS_INT *lenp
));
/*
** EX_SRV_RPCDB
**
** Example routine to return the database component name of the
** current remote procedure call designation, using srv_rpcdb.
**
** Arguments:
** spp A pointer to an internal thread control structure.
** dbp A return pointer to the null terminated database name.
** lenp A return pointer to an integer containing the length
** of the database name.
**
** Returns:
** CS_SUCCEED Database component name returned successfully.
** CS_FAIL An error was detected.
*/
CS_RETCODE ex_srv_rpcdb(spp, dbp, lenp)
SRV_PROC *spp;
CS_CHAR **dbp;
CS_INT *lenp;
{
/* Initialization.*/
*lenp = (CS_INT)0;
/* Retrieve the database component name. */
if ((*dbp = (CS_CHAR *)srv_rpcdb(spp, lenp)) == (CS_CHAR
*)NULL)
{
return(CS_FAIL);
}
return(CS_SUCCEED);
}
srv_rpcdb returns a CS_CHAR pointer to a null terminated string containing the database name component of the current remote procedure call designation.
srv_rpcdb returns only the database name part of the RPC’s designation and does not include anything else, such as optional specifiers for owner or RPC number. A fully qualified stored procedure designation takes the form database.owner.rpcname;number. To get the other parts of the RPC’s designation, if any, use srv_rpcname, srv_rpcowner, and srv_rpcnumber.
srv_numparams, srv_rpcname, srv_rpcnumber, srv_rpcoptions, srv_rpcowner