Return the number of parameters contained in the current client command.
CS_RETCODE srv_numparams(spp, numparamsp)
SRV_PROC *spp; CS_INT *numparamsp;
A pointer to an internal thread control structure.
A pointer to the number of arguments in the current client command or cursor data stream is returned in *numparamsp.
Returns  | 
To indicate  | 
|---|---|
CS_SUCCEED  | 
The routine completed successfully.  | 
CS_FAIL  | 
The routine failed.  | 
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE ex_srv_numparams PROTOTYPE((
SRV_PROC *spp,
CS_INT *countp
));
/*
** EX_SRV_NUMPARAMS
**
** Example routine to illustrate the use of srv_numparams to
** get the number parameters contained in the current client
** command.
**
** Arguments:
** spp A pointer to an internal thread control structure.
** countp A pointer to the buffer in which the number of
** parameters in the client command is returned.
**
** Returns:
**
** CS_SUCCEED The number of parameters was successfully
** returned.
** CS_FAIL An error was detected.
*/
CS_RETCODE ex_srv_numparams(spp, countp)
SRV_PROC *spp;
CS_INT *countp;
{
     if (srv_numparams(spp, countp) == CS_FAIL)
        return (CS_FAIL);
    return(CS_SUCCEED);
}
srv_numparams returns the number of parameters in the current MSG, RPC, DYNAMIC or cursor data stream, or the number of parameters in a client’s response to a srv_negotiate(CS_GET) call. This number includes any default parameters filled in by Open Server at runtime.
srv_numparams can only be called from handlers for specific events. Table 3-76 lists those events and their parameters:
Event  | 
Parameters  | 
|---|---|
SRV_CURSOR  | 
Cursor parameters.  | 
SRV_RPC  | 
RPC parameters.  | 
SRV_DYNAMIC  | 
Dynamic SQL parameters.  | 
SRV_MSG  | 
MSG parameters.  | 
SRV_LANGUAGE  | 
Language parameters. srv_numparams requires a TDS level of 5.0 or above to check for and retrieve parameter data in a language handler. You may need to add code to your application to check the TDS level on the connection, and skip srv_numparams if the TDS version is less than SRV_TDS_5_0. You can use the SRV_S_TDSVERSION property of the srv_props routine to get the TDS protocol version on the connection (see Table 2-25).  | 
After a srv_negotiate (CS_GET) call.  | 
Parameters in the client’s response. For example, in the sample program, ctos.c.  | 
srv_bind, srv_cursor_props, srv_descfmt, srv_dynamic, srv_msg, srv_xferdata, “Processing parameter and row data”