When developing a v4 table UDF or TPF, the library must declare how row information is transferred to the server.
Create a variable of type a_v4_extfn_table_func and set each member of this structure to the address of the function within the table UDF that implements the function. The information in this variable is made available to the server at runtime.
Not all members of a_v4_extfn_table_func are required and there are two reserved fields which must be set to NULL.
Use this descriptor as a model when developing your own table UDF:
{
udf_table_func_open, // required
udf_table_func_fetch_into, // one of fetch_into or fetch_block required
udf_table_func_fetch_block, // one of fetch_into or fetch_block required
udf_table_func_rewind, // optional
udf_table_func_close, // required
NULL, // Reserved: must be NULL
NULL // Reserved: must be NULL
};
At the start of execution, the server calls the a_v4_extfn_proc function _evaluate_extfn to give the table UDF an opportunity to tell the server what table functions it is implementing. To do this, the table UDF must create an instance of a_v4_extfn_table that is given to the server. This structure contains a pointer to the a_v4_extfn_table_func descriptor and the number of columns in the result set.
Use this descriptor as a model when developing your own table UDF:
static a_v4_extfn_table_udf_rg_table = {
&udf_table_funcs, // Table function descriptor
1 // number_of_columns
};