ODBC Server Reference Manual
Stored Procedures
HP NonStop ODBC Server Reference Manual—429151-002
5-28
SPELIB Interface
Programmers allocate the environment structure by simply calling “malloc” in C (or a
similar function in a different language), using a DEFINE that specifies the size of the
structure. For example:
malloc (SPEIPC_OBJECT_SIZE);
The DEFINE, SPEIPC_OBJECT_SIZE, is provided in the C header file (SPELIBH)
containing SPELIB function prototypes. The environment object must be allocated and
initialized before other SPELIB functions can be used.
As described earlier, in addition to the SPELIB functions a set of shell routines have
been provided with the sample Pathway server program. For each SPELIB function
that generates data to be returned to the NonStop ODBC Server, there is an equivalent
shell routine. The list of shell routines and their equivalent SPELIB functions follows:
encode_init SP_SRV_ENCODE_INIT
encode_end_proc SP_SRV_ENCODE_END_PROC
encode_end_statement SP_SRV_ENCODE_END_STATEMENT
encode_sql_diagnostic SP_SRV_ENCODE_SQL_DIAGNOSTIC
encode_return_status SP_SRV_ENCODE_RETURN_STATUS
encode_output_params SP_SRV_ENCODE_OUTPUT_PARAMS
encode_row_descriptor SP_SRV_ENCODE_ROW_DESCR
encode_row_data SP_SRV_ENCODE_ROW_DATA
encode_printmsg SP_SRV_ENCODE_PRINTMSG
encode_raiserror SP_SRV_ENCODE_RAISERROR
encode_spelib_error SP_SRV_ENCODE_SPELIB_ERROR
get_SPE_info SP_SRV_GET_SERVICE_NAME
SP_SRV_GET_SP_NAME
SP_SRV_GET_REQ_PROCESS_NAME
SP_SRV_GET_USER_NAME
get_input_params SP_SRV_GET_INPUT_PARAM_INFO
SP_SRV_GET_INPUT_PARAMS
SPELIB Functions for Decoding Requests
The following functions allow server programmers to decode stored procedure
execution requests (extract the procedure, get the NonStop ODBC server name, and
so on).
As stated previously, these functions cannot be used until the stored procedure
execution environment object has been allocated.