srv_paramset

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


Important This Open Data Services function or macro is only supported in Microsoft® SQL Server™ version 7.0 for backward compatibility. It has been superseded by the srv_paramsetoutput function.


For more information about Open Data Services functions or macros supported for backward compatibility, see Open Data Services (Level 3).

Syntax

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

Arguments
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 information 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 data type of the parameter is of a constant length and does not 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.

This function returns the following values, if the parameter is one of the new SQL Server 7.0 data types.

New data types Return data length
  NULL ZERO >=255 <255
BITN len = 0
data = IG
RET = 0
N/A N/A N/A
BIGVARCHAR len = 0
data = IG
RET = 1
len = IG
data = IG
RET = 0
len = max8k
data = valid
RET = 0
len = <8k
data = valid
RET = 1
BIGCHAR len = 0
data = IG
RET = 1
len = IG
data = IG
RET = 0
len = max8k
data = valid
RET = 0
len = <8k
data = valid
RET = 1
BIGBINARY len = 0
data = IG
RET = 1
len = IG
data = IG
RET = 0
len = max8k
data = valid
RET = 0
len = <8k
data = valid
RET = 1
BIGVARBINARY len = 0
data = IG
RET = 1
len = IG
data = IG
RET = 0
len = max8k
data = valid
RET = 0
len = <8k
data = valid
RET = 1
NCHAR len = 0
data = IG
RET = 1
len = IG
data = IG
RET = 0
len = max8k
data = valid
RET = 0
len = <8k
data = valid
RET = 1
NVARCHAR len = 0
data = IG
RET = 1
len = IG
data = IG
RET = 0
len = max8k
data = valid
RET = 0
len = <8k
data = valid
RET = 1
NTEXT len = IG
data = IG
RET = 0
len = IG
data = IG
RET = 0
len = IG
data = IG
RET = 0
len = IG
data = IG
RET = 0
RET = Return value of srv_paramset
IG = Value will be ignored
valid = Any valid pointer to data

Remarks

Parameters contain data 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.

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

srv_paramsetoutput

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.