RPC command results handling

Code your application to handle the results of an RPC command with a standard results loop, as discussed in “Structure of the basic loop”.

RPC commands can return the result types listed in Table 5-3, for the given reasons:

Table 5-3: Result types from the execution of an RPC command

Result type

Meaning/when received

CS_ROW_RESULT

Regular rows, sent in response to a select statement executed by the procedure.

CS_COMPUTE_RESULT

Compute rows, sent in response to a selectstatement that contains a compute by clause.

CS_PARAM_RESULT

Return (output) parameter values, received after results from all statements in the procedure have been processed.

CS_STATUS_RESULT

The procedure’s return status, received after results from all statements in the procedure have been processed.

CS_COMPUTEFMT_ RESULT, CS_ROWFMT_RESULT

Format results, seen only if the CS_EXPOSE_FMTS connection property is CS_TRUE (the default is CS_FALSE).

CS_CMD_DONE

Placeholder that indicates the results of one logical command have been processed. Seen after the following events:

  • The results from each statement executed in the language batch have been processed

  • The results of each select statement executed by a called stored procedure have been completely processed

CS_CMD_SUCCEED

Indicates that the procedure was invoked successfully, but does not mean that all the statements in the stored procedure executed successfully. Applications must always check the stored procedure’s return status value to determine whether an error occurred (see “Return status values”).

CS_CMD_FAIL

Indicates that the procedure call failed. Not all errors cause CS_CMD_FAIL to be returned. A statement may fail in the stored procedure, but the server still returns a result type of CS_CMD_SUCCEED.

Applications must always check the stored procedure’s return status value to determine whether an error occurred (see “Return status values”).