The EXTFNAPIV4_DESCRIBE_PARM_WIDTH attribute indicates the width of a parameter. Used in a describe_parameter_get scenario.
a_sql_uint32
The width of a parameter to a UDF. EXTFNAPIV4_DESCRIBE_PARM_WIDTH applies only to scalar parameters. Parameter width is the amount of storage, in bytes, required to store a parameter of the associated data type.
Gets the width of the parameter as defined in the CREATE PROCEDURE statement.
On success, returns the sizeof(a_sql_uint32).
Sample procedure definition:
CREATE PROCEDURE my_udf(IN p1 INT, IN p2 char(100)) 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_uint32 width = 0; a_sql_int32 ret = 0; // Get the width of parameter 1 ret = cntxt->describe_parameter_get( cntxt, 1, EXTFNAPIV4_DESCRIBE_PARM_WIDTH, &width, sizeof(a_sql_uint32) ); if( ret < 0 ) { // Handle the error. } //Allocate some storage based on parameter width a_sql_byte *p = (a_sql_byte *)cntxt->alloc( cntxt, width ) // Get the width of parameter 2 ret = cntxt->describe_parameter_get( cntxt, 2, EXTFNAPIV4_DESCRIBE_PARM_WIDTH, &width, sizeof(a_sql_uint32) ); if( ret <= 0 ) { // Handle the error. } // Allocate some storage based on parameter width char *c = (char *)cntxt->alloc( cntxt, width ) … } }