![]() |
MySQL 8.0.43
Source Code Documentation
|
#include <assert.h>#include <ctype.h>#include <mysql/components/component_implementation.h>#include <mysql/components/my_service.h>#include <mysql/components/service_implementation.h>#include <mysql/components/services/audit_api_message_service.h>#include <mysql/components/services/udf_metadata.h>#include <mysql/components/services/udf_registration.h>#include <mysql/service_plugin_registry.h>#include <mysql_com.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <algorithm>#include <cstdarg>#include <map>#include <memory>#include <string>#include "my_compiler.h"#include "template_utils.h"Classes | |
| class | IError_handler |
| Error handling interface. More... | |
| struct | Arg_type |
| Structure used for argument type validation. More... | |
| struct | Arg_def |
| Argument definition structure. More... | |
| class | String_error_handler |
| Error handler that copies error message into specified buffer. More... | |
Namespaces | |
Typedefs | |
| typedef bool(* | validate_function) (IError_handler &handler, const char *arg, unsigned long length, size_t arg_pos) |
| Argument validation function prototype. More... | |
Functions | |
| REQUIRES_SERVICE_PLACEHOLDER (mysql_udf_metadata) | |
| audit_api_message_emit component exposes audit_log_message UDF that generates MYSQL_AUDIT_MESSAGE_USER event of the MYSQL_AUDIT_MESSAGE_CLASS class. More... | |
| REQUIRES_SERVICE_PLACEHOLDER (mysql_audit_api_message) | |
| REQUIRES_SERVICE_PLACEHOLDER (udf_registration) | |
| static bool | not_null (IError_handler &handler, const char *arg, unsigned long length, size_t arg_pos) |
| Check, whether the argument is not null pointer. More... | |
| size_t | max_arg_count (Arg_def *arg_def, size_t arg_def_size) |
| Max argument count of all definitions. More... | |
| static bool | set_args_charset_info (UDF_ARGS *args, IError_handler &handler) |
| Set the character set and collation of each argument. More... | |
| bool | set_return_value_charset_info (UDF_INIT *initid, IError_handler &handler) |
| Sets the charset info of the return value to utf8mb4. More... | |
| static int | arg_check (IError_handler &handler, unsigned int arg_count, Item_result *arg_type, Arg_def *arg_def, size_t arg_def_size, char **args, unsigned long *arg_lengths, bool strict_arg_count=true) |
| Check, whether specified arguments match the definitions. More... | |
| static bool | arg_check (IError_handler &handler, UDF_ARGS *args) |
| Argument check for UDF provided arguments. More... | |
| static char * | emit (UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, unsigned char *null_value, unsigned char *error) |
| UDF function itself. More... | |
| static bool | emit_init (UDF_INIT *initd, UDF_ARGS *args, char *message) |
| UDF initialization. More... | |
| static mysql_service_status_t | init () |
| Component initialization. More... | |
| static mysql_service_status_t | deinit () |
| Component deinitialization. More... | |
| END_COMPONENT_PROVIDES () | |
| REQUIRES_SERVICE (mysql_audit_api_message) | |
| REQUIRES_SERVICE (udf_registration) | |
| REQUIRES_SERVICE (mysql_udf_metadata) | |
| END_COMPONENT_REQUIRES () | |
| METADATA ("mysql.author", "Oracle Corporation") | |
| METADATA ("mysql.license", "GPL") | |
| END_COMPONENT_METADATA () | |
Variables | |
| Arg_type | audit_log_primary_args [] |
| Obligatory UDF parameters. More... | |
| Arg_type | audit_log_key_value_string_args [] |
| Key value string parameters. More... | |
| Arg_type | audit_log_key_value_int_args [] |
| Key value numeric parameters. More... | |
| Arg_def | audit_log_primary_args_def [] |
| Obligatory arguments definition (component, producer, message). More... | |
| Arg_def | audit_log_extra_args_def [] |
| Optional arguments definition (key, value). More... | |
| const char * | anonymous_namespace{audit_api_message_emit.cc}::collation = ("utf8mb4_general_ci") |
| char * | anonymous_namespace{audit_api_message_emit.cc}::collation_name = const_cast<char *>(collation) |
| mysql_component_t | mysql_component_audit_api_message_emit |
| typedef bool(* validate_function) (IError_handler &handler, const char *arg, unsigned long length, size_t arg_pos) |
Argument validation function prototype.
| handler | Error reporting handler. |
| arg | Argument value pointer. |
| length | Argument value length. |
| arg_pos | Argument pos. |
|
static |
Argument check for UDF provided arguments.
This checks both, obligatory and optional arguments.
| handler | Error handler used for error handling. |
| args | UDF_ARGS structure. |
| false | Succeeded. Arguments are ok. |
| true | Failed. Error is reported via specified handler. |
|
static |
Check, whether specified arguments match the definitions.
| handler | Error reporting handler. |
| arg_count | Number of arguments. |
| arg_type | Argument type array. |
| arg_def | Argument definitions. |
| arg_def_size | Argument definitions size. |
| args | UDF arguments. |
| arg_lengths | UDF argument lengths. |
| strict_arg_count | Strictly check provided argument count. If this is set to false, if the provided argument count is greater, this does not return error. |
| -1 | None of the argument definition was matched. |
| >=0 | n-th argument definition was matched. |
|
static |
Component deinitialization.
|
static |
UDF function itself.
Allocate array that is used by the audit api service.
UDF initialization.
Check argument correctness.
| initd | UDF initializer structure |
| args | UDF arguments. |
| message | Buffer, where the error is to be written. |
| END_COMPONENT_METADATA | ( | ) |
| END_COMPONENT_PROVIDES | ( | ) |
| END_COMPONENT_REQUIRES | ( | ) |
|
static |
Component initialization.
| size_t max_arg_count | ( | Arg_def * | arg_def, |
| size_t | arg_def_size | ||
| ) |
Max argument count of all definitions.
| arg_def | Argument definitions. |
| arg_def_size | Argument definitions size. |
| METADATA | ( | "mysql.author" | , |
| "Oracle Corporation" | |||
| ) |
| METADATA | ( | "mysql.license" | , |
| "GPL" | |||
| ) |
|
static |
Check, whether the argument is not null pointer.
| REQUIRES_SERVICE | ( | mysql_audit_api_message | ) |
| REQUIRES_SERVICE | ( | mysql_udf_metadata | ) |
| REQUIRES_SERVICE | ( | udf_registration | ) |
| REQUIRES_SERVICE_PLACEHOLDER | ( | mysql_audit_api_message | ) |
| REQUIRES_SERVICE_PLACEHOLDER | ( | mysql_udf_metadata | ) |
audit_api_message_emit component exposes audit_log_message UDF that generates MYSQL_AUDIT_MESSAGE_USER event of the MYSQL_AUDIT_MESSAGE_CLASS class.
All installed audit plugins that subscribe MYSQL_AUDIT_MESSAGE_USER event will receive this event.
| REQUIRES_SERVICE_PLACEHOLDER | ( | udf_registration | ) |
|
static |
Set the character set and collation of each argument.
| [in,out] | args | UDF arguments structure |
| [out] | handler | Error handler |
| false | Set the charset of all arguments successfully |
| true | Otherwise |
| bool set_return_value_charset_info | ( | UDF_INIT * | initid, |
| IError_handler & | handler | ||
| ) |
Sets the charset info of the return value to utf8mb4.
| [in,out] | initid | A pointer to the UDF_INIT structure |
| [out] | handler | Error handler that keeps the error message |
| false | Charset info of return value set successfully. |
| true | Otherwise |
| Arg_def audit_log_extra_args_def[] |
Optional arguments definition (key, value).
| Arg_type audit_log_key_value_int_args[] |
Key value numeric parameters.
| Arg_type audit_log_key_value_string_args[] |
Key value string parameters.
| Arg_type audit_log_primary_args[] |
Obligatory UDF parameters.
| Arg_def audit_log_primary_args_def[] |
Obligatory arguments definition (component, producer, message).
| mysql_component_t mysql_component_audit_api_message_emit |