MySQL 9.1.0
Source Code Documentation
s_mysql_mysql_udf_metadata Struct Reference

Service for getting and setting the extension attributes of UDF arguments and return value. More...

#include <udf_metadata.h>

Public Attributes

mysql_service_status_t(* argument_get )(UDF_ARGS *udf_args, const char *extension_type, unsigned int index, void **out_value)
 Retrieves extension attributes of a UDF argument. More...
 
mysql_service_status_t(* result_get )(UDF_INIT *udf_init, const char *extension_type, void **out_value)
 Retrieves the extension attribute of UDF return value. More...
 
mysql_service_status_t(* argument_set )(UDF_ARGS *udf_args, const char *extension_type, unsigned int index, void *in_value)
 Sets the extension attribute of a UDF argument. More...
 
mysql_service_status_t(* result_set )(UDF_INIT *udf_init, const char *extension_type, void *in_value)
 Sets the extension attribute of the UDF return value. More...
 

Detailed Description

Service for getting and setting the extension attributes of UDF arguments and return value.

Member Data Documentation

◆ argument_get

mysql_service_status_t(* s_mysql_mysql_udf_metadata::argument_get) (UDF_ARGS *udf_args, const char *extension_type, unsigned int index, void **out_value)

Retrieves extension attributes of a UDF argument.

The extension attributes are retrieved based on the extension_type. Following extension_type are supported as of now :

(1) charset - Character set name of a UDF argument (2) collation - Collation name of a UDF argument.

The method returns the requested extension attribute in the output parameter. One must cast the output value to a respective data type. It sets error message if it is unable to retrieve extension attribute

One could retrieve the charset of first UDF argument as following.

void *out_value = nullptr; my_service<SERVICE_TYPE(mysql_udf_metadata)> service("mysql_udf_metadata", mysql_plugin_registry_acquire()); service->argument_get(udf_args, "charset", 0, &out_value); const char *charset_name = static_cast<const char *>(out_value);

Parameters
[in]udf_argsPointer to the UDF arguments struct that contains the extension pointer.
[in]extension_typeArgument type to get
[in]indexIndex of UDF argument
[out]out_valuePointer to the character set
Returns
true Error conditions. For instance :
  1. invalid argument type 'extension_type'
  2. null extension pointer false Otherwise

◆ argument_set

mysql_service_status_t(* s_mysql_mysql_udf_metadata::argument_set) (UDF_ARGS *udf_args, const char *extension_type, unsigned int index, void *in_value)

Sets the extension attribute of a UDF argument.

The extension attribute could be set only for supported extension type. Following extension_type are supported:

(1) charset - Character set name of a UDF argument (2) collation - Collation name of a UDF argument.

The method sets the input value as the extension attribute of corresponding UDF argument. It sets error message if it is unable to set the extension attribute.

One could set the charset of first argument as following.

const char* name = "utf8mb4"; char value = const_cast<char>(name); my_service<SERVICE_TYPE(mysql_udf_metadata)> service("mysql_udf_metadata", mysql_plugin_registry_acquire()); service->argument_set(udf_args, "charset", 0, static_cast<void *>(value));

Parameters
[in,out]udf_argsPointer to the UDF arguments struct that contains the extension pointer.
[in]extension_typeArgument type to set.
[in]argumentsPointer to input arguments to set.If it is a char* then that must be null terminated.
Returns
true Error conditions. For instance :
  1. invalid argument type 'extension_type'
  2. null extension pointer false Otherwise

◆ result_get

mysql_service_status_t(* s_mysql_mysql_udf_metadata::result_get) (UDF_INIT *udf_init, const char *extension_type, void **out_value)

Retrieves the extension attribute of UDF return value.

a UDF argument. The extension attributes are retrieved based on the extension_type. Following extension_type are supported:

(1) charset - Character set name of a UDF argument (2) collation - Collation name of a UDF argument.

The method returns the requested extension attribute in the output parameter. One must cast the output value to a respective data type. It sets error message if it is unable to retrieve extension attribute

One could retrieve the charset of return value as following.

void *out_value = nullptr; my_service<SERVICE_TYPE(mysql_udf_metadata)> service("mysql_udf_metadata", mysql_plugin_registry_acquire()); service->result_get(udf_init, "charset", 0, &out_value); const char *charset_name = static_cast<const char *>(out_value);

Parameters
[in]udf_initPointer to the UDF_INIT struct struct that contains the extension pointer for return value
[in]extension_typeArgument type to get
[out]out_valuePointer to the arguments.
Returns
true Error conditions. For instance :
  1. invalid argument type 'extension_type'
  2. null extension pointer false Otherwise

◆ result_set

mysql_service_status_t(* s_mysql_mysql_udf_metadata::result_set) (UDF_INIT *udf_init, const char *extension_type, void *in_value)

Sets the extension attribute of the UDF return value.

The extension attribute could be set only for supported extension type. Following extension_type are supported:

(1) charset - Character set name of a UDF argument (2) collation - Collation name of a UDF argument.

The method sets the input value as the extension attribute of return value. It sets error message if it is unable to set the extension attribute.

One could set the charset of return value as following.

const char* name = "utf8mb4"; char value = const_cast<char>(name); my_service<SERVICE_TYPE(mysql_udf_metadata)> service("mysql_udf_metadata", mysql_plugin_registry_acquire()); service->result_set(udf_init, "charset", 0, static_cast<void *>(value));

Parameters
[in,out]udf_initPointer to UDF_INIT argument that contains the extension pointer.
[in]extension_typeArgument type that has to be set as an extension argument. If it is invalid then the method does nothing.
[in]in_valueInput argument that has to be read. If it is a char* then that must be null terminated.
Returns
true Error conditions. For instance :
  1. invalid argument type 'extension_type'
  2. null extension pointer false Otherwise

The documentation for this struct was generated from the following file: