srv_paramset

Sets the value of a remote stored procedure call return parameter.

Syntax

int srv_paramset (
SRV_PROC *
srvproc,
int
n,
void *
data,
int
len );

where

srvproc
Is a pointer to the SRV_PROC structure that is the handle for a particular client connection (in this case, the handle that received the remote stored procedure call). The structure contains the information that the ODS Library uses to manage communication and data between the Open Data Services server application and the client.
n
Indicates the number of the parameter to set. The first parameter is 1.
data
Is a pointer to the data value to be sent back to the client as the remote stored procedure return parameter.
len
Specifies the actual length of the data to be returned. If the datatype of the parameter is one that is of a constant length and doesn't allow null values (for example, srvbit or srvint1), len is ignored.

Returns

SUCCEED if the parameter value was successfully set; otherwise, FAIL. FAIL is returned when there is no current remote stored procedure, when there is no nth remote stored procedure parameter, when the parameter is not a return parameter, and when the len argument isn't legal.

If len is 0, returns NULL. Setting len to 0 is the only way to return NULL to the client.

Remarks

Parameters contain data that is passed between clients and the Open Data Services server application with remote stored procedures. The client can specify certain parameters as return parameters. These return parameters can contain values that the Open Data Services server application passes back to the client. Using return parameters is analogous to passing parameters by reference.

You cannot set the return value for a parameter that wasn't invoked as a return parameter. You can use srv_paramstatus to determine how the parameter was invoked.

This function sets the return value for a parameter but it doesn't actually send the return value to the client. All return parameters, whether their return values have been set with srv_paramset or not, are automatically sent to the client when srv_senddone is called with the status flag SRV_DONE_FINAL set.

The srv_paramset function provides the only way to reset return parameters when the current client command is a remote stored procedure.

When a remote stored procedure call is made with parameters, the parameters can be passed either by name or by position (unnamed). If the remote stored procedure call is made with some parameters passed by name and some passed by position, an error occurs. The SRV_RPC handler is still called, but it appears as if there were no parameters, and srv_rpcparams returns 0.

See Also

This entry For information about
srv_paramdata Returning the value of a remote stored procedure parameter
srv_paramlen Returning the data length of a remote stored procedure parameter
srv_parammaxlen Returning the maximum data length of a remote stored procedure parameter
srv_paramname Returning the name of a remote stored procedure parameter
srv_paramnumber Returning the number of a remote stored procedure parameter
srv_paramstatus Returning the status of a remote stored procedure parameter
srv_paramtype Returning the datatype of a remote stored procedure parameter