Building RPC commands

Your application initiates an RPC command by calling ct_command with type as CS_RPC_CMD, *buffer as the procedure name, and option as CS_NO_RECOMPILE, CS_RECOMPILE, or CS_UNUSED. For example:

ct_command(cmd, CS_RPC_CMD, rpc_name, CS_NULLTERM,
CS_NO_RECOMPILE)

The option value indicates whether the server should recompile the procedure. When invoking an Adaptive Server Enterprise stored procedure, CS_RECOMPILE is equivalent to specifying the with recompile clause in an equivalent execute statement. See the Adaptive Server Enterprise documentation for an explanation of when recompilation is useful.

Parameter values for an RPC command are passed with calls to ct_param or ct_setparam. These routines are identical, except that ct_param copies a data value, while ct_setparam copies pointers to data values. Both routines require a CS_DATAFMT structure, an indicator variable, and the address of a data value. See the reference pages for ct_param and ct_setparam in the Open Client Client-Library/C Reference Manual.

For RPC commands, code your ct_param or ct_setparam calls according to the following rules:

For an example that illustrates how to define an RPC command with parameters, see the reference page for ct_param in the Open Client Client-Library/C Reference Manual.