External Procedure Context (a_v4_extfn_proc_context)

Use the a_v4_extfn_proc_context structure to retain context information from the server and from the UDF.

Implementation

typedef struct a_v4_extfn_proc_context {
.
.
. 
} a_v4_extfn_proc_context;

Method Summary

Return Type Method Description
short get_value Gets input arguments to the UDF.
short get_value_is_constant Allows the UDF to ask whether a given argument is a constant.
short set_value Used by the UDF in either the _evaluate_extfn or _describe_extfn functions to describe to the server what its output will look like and to inform the server how to fetch results from the UDF.
a_sql_uint32 get_is_cancelled Call the get_is_cancelled callback every second or two to see if the user has interrupted the current statement.
short set_error Rolls back the current statement and generates an error.
void log_message Writes a message to the message log.
short convert_value Converts one data type to another.
short get_option Gets the value of a settable option.
void alloc Allocates a block of memory of length at least "len".
void free Free the memory allocated by alloc() for the specified lifetime.
a_sql_uint32 describe_column_get See *describe_column_get.
a_sql_uint32 describe_column_set See *describe_column_set.
a_sql_uint32 describe_parameter_get See *describe_parameter_get.
a_sql_uint32 describe_parameter_set See *describe_parameter_set.
a_sql_uint32 describe_udf_get See *describe_udf_get.
a_sql_uint32 describe_udf_set See *describe_udf_set.
short open_result_set Opens a result set for a table value.
short close_result_set Closes an open result set.
short get_blob Retrieves an input parameter that is a blob.
short set_cannot_be_distributed Disables distribution at the UDF level even if the library is distributable.

Data Members and Data Types Summary

Data Member Data Type Description
_user_data void * This data pointer can be filled in by any usage with whatever context data the external routine requires.
_executionMode a_sql_uint32 Indicates the debug/trace level requested via the External_UDF_Execution_Mode option. This is a read-only field.
current_state a_sql_uint32 The current_state attribute reflects the current execution mode of the context. This can be queried from functions such as _describe_extfn to determine what course of action to take.

Description

In addition to retaining context information from the server and the UDF, the structure a_v4_extfn_proc_context allows the UDF to call back into the server to perform certain actions. The UDF can store private data in this structure in the _user_data member. An instance of this structure gets passed to the functions in the a_v4_extfn_proc method by the server. User data is not maintained until after the server reaches the Annotation state.