ODBC Server Reference Manual

Stored Procedures
HP NonStop ODBC Server Reference Manual429151-002
5-8
Server Logic Sequence
Send the reply or write the output buffer back by utilizing the call-back feature as
needed.
The following diagram illustrates the calling sequences involved. The SP_SRV_xxx
functions are explained in detail under SPELIB Interface on page 5-27. In addition to
the SPELIB functions, a set of shell routines has been provided with the sample
Pathway server program.
The following sequences apply to both the shell routines and the equivalent SPELIB
functions.
NonStop ODBC Server Pathway Server
PATHSEND( buffer, messagelen );
.
.
1. Do READUPDATE from $RECEIVE
process_event_queue [shell routines]
.
/* NSODBC server now waits for */
/* PATHSEND to terminate. */
.
.
.
2.
Decode message.
process_request [shell routines]
or
SP_SRV_DECODE_INIT [SPELIB]
.
.
.
.
.
.
3. Get stored procedure information.
get_spe_info
[shell routines]
or
SP_SRV_GET_SERVICE_NAME [SPELIB]
.
.
.
.
.
.
.
.
.
.
.
4. Get number of input parameters.
5. Allocate space for SQLDA.
6. Get input parameters into SQLDA.
7. Allocate space for parameter values.
get_input_params [shell routines]
or
SP_SRV_GET_NUM_INPUT_PARAMS [SPELIB]
SP_SRV_GET_INPUT_PARAM_INFO
SP_SRV_GET_INPUT_PARAMS
.
.
.
.
8. Execute SQL to satisfy SP request.
/* -- WAIT -- */
.
.
.
.
.
.
9. Encode REPLY.
encode_init [shell routines]
or
SP_SRV_ENCODE_INIT@@@ [SPELIB]
.
.
.
.
.
.
10. Set up column definitions.
encode_row_descriptor [shell routines]
or
SP_SRV_ENCODE_ROW_DESCR [SPELIB]
.
.
.
.
.
.
.
.
11. Set up result set.
encode_row_data [shell routines]
or
SP_SRV_ENCODE_ROW_DATA [SPELIB]
.
Repeat Step 11 as needed.
.