ODBC Server Reference Manual

Stored Procedures
HP NonStop ODBC Server Reference Manual429151-002
5-44
SPELIB Interface
SPELIB Return Codes
The following describes the error codes returned by the SPELIB interface; they can be
used for decision-making in subsequent SPELIB function calls.
SPELIB_OK
The operation was completed successfully.
SPELIB_BUFFER_OVERFLOW
The reply buffer became full during SPEIPC encoding. The server program should
use the call-back mechanism to send the result back to the requester.
For example:
SP_SRV_ENCODE_INIT (senv, replybuf, maxlen);
...
SP_SRV_ENCODE_ROW_DESCR (senv, sqlda);
Fetch_loop:
/* SQL Fetch a row data. */
...
rc = SP_SRV_ENCODE_ROW_DATA (senv, sqlda);
if (rc == SPELIB_BUFFER_OVERFLOW)
/* Do call-back, OPEN requester process, */
/* if it is not opened already. */
OPEN (<requester process>);
/* Send this buffer to the requester. */
WRITE (<requester process>, replybuf, len);
/* Allocate buffer or reuse same buffer. Always call */
/* ENCODE_INIT for any "new" buffer to be used. */
SP_SRV_ENCODE_INIT (senv, replybuf, maxlen); ...
/* Need to encode the one that previously failed. */
SP_SRV_ENCODE_ROW_DATA (senv, sqlda);
...
GOTO Fetch_loop;
/* End Fetch Loop */
...
/* Finally, reply to PATHSEND. */
REPLY(repbuf, len, ,0);
SPELIB_INSUFFICIENT_BUFFER
The reply buffer is too small. The reply buffer size must be greater than
SPEIPC_MIN_BUFFER_SIZE and less than SPEIPC_MAX_BUFFER_SIZE (32K
bytes). The server class program can readjust the buffer size or encode the
SPELIB error and issue a REPLY.