MySQL 8.4.2
Source Code Documentation
|
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... | |
Service for getting and setting the extension attributes of UDF arguments and return value.
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);
[in] | udf_args | Pointer to the UDF arguments struct that contains the extension pointer. |
[in] | extension_type | Argument type to get |
[in] | index | Index of UDF argument |
[out] | out_value | Pointer to the character 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));
[in,out] | udf_args | Pointer to the UDF arguments struct that contains the extension pointer. |
[in] | extension_type | Argument type to set. |
[in] | arguments | Pointer to input arguments to set.If it is a char* then that must be null terminated. |
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);
[in] | udf_init | Pointer to the UDF_INIT struct struct that contains the extension pointer for return value |
[in] | extension_type | Argument type to get |
[out] | out_value | Pointer to the arguments. |
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));
[in,out] | udf_init | Pointer to UDF_INIT argument that contains the extension pointer. |
[in] | extension_type | Argument type that has to be set as an extension argument. If it is invalid then the method does nothing. |
[in] | in_value | Input argument that has to be read. If it is a char* then that must be null terminated. |