EXTFNAPIV4_DESCRIBE_PARM_TABLE_REQUEST_REWIND Attribute (Set)

The EXTFNAPIV4_DESCRIBE_PARM_TABLE_REQUEST_REWIND attribute indicates that the consumer requests rewind of an input table. Used in a describe_parameter_set scenario.

Data Type

a_sql_byte

Description

Indicates that the consumer wants to rewind an input table. Valid only for table input arguments. By default, this property is false.

Usage

If the UDF requires input table rewind capability, the UDF must set this property during Optimization.

Returns

On success, returns sizeof(a_sql_byte).

On failure, returns one of the generic describe_parameter errors, or:
  • EXTFNAPIV4_DESCRIBE_BUFFER_SIZE_MISMATCH – set error returned if the describe_buffer is not the size of a_sql_byte.
  • EXTFNAPIV4_DESCRIBE_INVALID_STATE – set error returned if the state is not equal to Optimization.
  • EXTFNAPIV4_DESCRIBE_INVALID_PARAMETER – set error returned if the UDF attempts to set this attribute on parameter 0.
  • EXTFNAPIV4_DESCRIBE_NON_TABLE_PARAMETER – set error returned if the UDF attempts to set this attribute on a parameter that is not a table.
  • EXTFNAPIV4_DESCRIBE_INVALID_ATTRIBUTE_VALUE – set error returned if the UDF attempts to set this attribute to a value other than 0 or 1.

Query Processing States

Valid in:
  • Optimization state

Example

In this example, when the function my_udf_describe is called during the Optimization state, the call to describe_parameter_set informs the producer of the table input parameter 1 that a rewind may be required.

Sample procedure definition:

CREATE PROCEDURE my_udf(IN t TABLE(c1 INT))
RESULT (x INT)
EXTERNAL NAME ‘my_udf@myudflib’;

Sample _describe_extfn API function code fragment:

my_udf_describe(a_v4_extfn_proc_context *cntxt)
{
if( cntxt->current_state == EXTFNAPIV4_STATE_OPTIMIZATION ) {
a_sql_byte rewind_required = 1;
a_sql_int32 ret = 0;

ret = cntxt->describe_parameter_set( cntxt, 1, 
EXTFNAPIV4_DESCRIBE_PARM_TABLE_REQUEST_REWIND,
&rewind_required,
sizeof(a_sql_byte) );

if( ret <= 0 ) {
    // Handle the error.
}
}
}