Send parameters or data to a client, or receive parameters or data from a client.
CS_RETCODE srv_xferdata(spp, cmd, type)
SRV_PROC *spp; CS_INT cmd; CS_INT type;
A pointer to an internal thread control structure.
Indicates whether the data is going out to a client or coming in from a client. The following table describes the legal values for cmd:
Value |
Description |
---|---|
CS_SET |
The application is calling srv_xferdata to send data to a client. |
CS_GET |
The application is calling srv_xferdata to retrieve data from a client. |
The type of data stored into or read from the program variable. The following table describes the valid types and their appropriate context:
Type |
Valid cmd |
Description of data |
---|---|---|
SRV_RPCDATA |
CS_SET or CS_GET |
RPC parameter |
SRV_ROWDATA |
CS_SET only |
Result row column |
SRV_CURDATA |
CS_GET only |
Cursor parameter |
SRV_KEYDATA |
CS_GET only |
Cursor key column |
SRV_ERRORDATA |
CS_SET only |
Error message parameter |
SRV_DYNDATA |
CS_SET or CS_GET |
Dynamic SQL parameter |
SRV_NEGDATA |
CS_SET or CS_GET |
Negotiated login parameter |
SRV_MSGDATA |
CS_SET or CS_GET |
Message parameter |
SRV_LANGDATA |
CS_GET only |
Language parameter |
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE ex_srv_xferdata PROTOTYPE((
SRV_PROC *spp
));
/*
** EX_SRV_XFERDATA
**
** This routine will send error message parameters to the
** specified client.
**
**
** Arguments:
**
** spp A pointer to an internal thread control structure.
**
** Returns
**
** CS_SUCCEED
** CS_FAIL
**
*/
CS_RETCODE ex_srv_xferdata(spp)
SRV_PROC *spp;
{
/* Check arguments. */
if(spp == (SRV_PROC *)NULL)
{
return(CS_FAIL);
}
return(srv_xferdata(spp,CS_SET,SRV_ERRORDATA));
}
srv_xferdata is used to send parameter or row data to a client (CS_SET), or retrieve parameter or key data from a client. Specifically, it moves data out of local program variables and across the network to the client (CS_SET), or across the network from a client and into local program variables (CS_GET).
The data as it must appear to the client (CS_SET) or appeared to the client (CS_GET) must have previously been described using srv_desc&fmt. The application must also have previously called srv_bind to define local program variables.
srv_xferdata must be called once for each parameter stream (CS_GET, CS_SET) or once for each data row (CS_SET).