MySQL 9.1.0
Source Code Documentation
Component Services Inventory

This is a group of all component service APIs. More...

Collaboration diagram for Component Services Inventory:

Modules

 Event tracking services
 
 Keyring component services
 
 MySQL string services
 
 Table Access services
 

Classes

struct  s_mysql_mysql_audit_api_connection
 A service to generate Audit API events of the connection class (MYSQL_AUDIT_CONNECTION_CLASS). More...
 
struct  s_mysql_mysql_audit_api_connection_with_error
 A service to generate Audit API events of the connection class (MYSQL_AUDIT_CONNECTION_CLASS) with the explicitly specified error code value. More...
 
struct  s_mysql_component_sys_variable_register
 Service to register variable and get variable value. More...
 
struct  s_mysql_component_sys_variable_unregister
 Service to unregister variable. More...
 
struct  s_mysql_component_thread_cleanup_handler
 A service to cleanup component thread resource. More...
 
struct  s_mysql_dynamic_loader_services_loaded_notification
 A service to notify consumers about services loaded through dynamic loader. More...
 
struct  s_mysql_dynamic_loader_services_unload_notification
 A service to notify consumers about services to be unloaded through dynamic loader. More...
 
struct  s_mysql_dynamic_privilege_register
 A service to register and unregister dynamic privileges. More...
 
struct  s_mysql_dynamic_privilege_deprecation
 A service to register and unregister dynamic privileges as deprecated. More...
 
struct  s_mysql_group_replication_flow_control_metrics_service
 A service that retrieve extra flow control stats from a member. More...
 
struct  s_mysql_group_replication_message_service_send
 A service that sends content agnostic messages from a member to the group. More...
 
struct  s_mysql_group_replication_status_service_v1
 A service to get the status of a member of Group Replication. More...
 
struct  s_mysql_host_application_signal
 A service to deliver a signal to host application. More...
 
struct  s_mysql_mysql_keyring_iterator
 Keyring iterator component service definition, which enables to iterate over items stored within currently used keyring. More...
 
struct  s_mysql_external_program_capability_query
 A service to query various properties/capabilities of the implementer of s_mysql_external_program_execution service. More...
 
struct  s_mysql_external_program_execution
 A service to setup and execute multi-lingual stored procedures. More...
 
struct  s_mysql_mysql_admin_session
 A service to create an "admin" session that's not a subject to max connection count limits. More...
 
struct  s_mysql_mysql_audit_print_service_double_data_source
 Audit print service allows to obtain data of the double type associated with the THD object, which keeps various data of the user session. More...
 
struct  s_mysql_mysql_audit_print_service_longlong_data_source
 Audit print service allows to obtain data of the long long type associated with the THD object, which keeps various data of the user session. More...
 
struct  s_mysql_mysql_authentication_registration
 A service to do registration of fido device. More...
 
struct  s_mysql_mysql_text_consumer_factory_v1
 An implementation of these services will be called as the data resulting from calling mysql_query() service are produced by the server. More...
 
struct  s_mysql_mysql_text_consumer_metadata_v1
 A service that provides the apis for start_result_metadata, field_metadata, and end_result_metadata. More...
 
struct  s_mysql_mysql_text_consumer_row_factory_v1
 A service that provides the apis for start_row, abort_row and end_row. More...
 
struct  s_mysql_mysql_text_consumer_error_v1
 A service that provides the apis for handle_ok, handle_error and error. More...
 
struct  s_mysql_mysql_text_consumer_get_null_v1
 A service that provides the apis for get_null. More...
 
struct  s_mysql_mysql_text_consumer_get_integer_v1
 A service that provides the apis for get_integer. More...
 
struct  s_mysql_mysql_text_consumer_get_longlong_v1
 A service that provides the apis for get_longlong. More...
 
struct  s_mysql_mysql_text_consumer_get_decimal_v1
 A service that provides the apis for get_decimal. More...
 
struct  s_mysql_mysql_text_consumer_get_double_v1
 A service that provides the apis for get_double. More...
 
struct  s_mysql_mysql_text_consumer_get_date_time_v1
 A service that provides the apis for get_date, get_time and get_datatime. More...
 
struct  s_mysql_mysql_text_consumer_get_string_v1
 A service that provides the apis for get_string. More...
 
struct  s_mysql_mysql_text_consumer_client_capabilities_v1
 A service that provides the apis for client_capabilities. More...
 
struct  s_mysql_mysql_command_factory
 A service that provides the apis for mysql command init, info, connect, reset, close, commit, auto_commit and rollback. More...
 
struct  s_mysql_mysql_command_thread
 A service that provides the apis for mysql command session thread init and thread end. More...
 
struct  s_mysql_mysql_command_options
 A service that provides the apis for mysql command get_option and set_option. More...
 
struct  s_mysql_mysql_command_query
 A service that provides the apis for mysql command query and affected_rows. More...
 
struct  s_mysql_mysql_command_query_result
 A service that provides the apis for mysql command, store_result, free_result, more_results, next_result, result_metadata and fetch_row. More...
 
struct  s_mysql_mysql_command_field_info
 A service that provides the apis for mysql command field info, fetch_field, num_fields, fetch_fields and field_count. More...
 
struct  s_mysql_mysql_command_field_metadata
 Fetch the metadata of a service. More...
 
struct  s_mysql_mysql_command_error_info
 A service that provides the apis for mysql command error info, mysql_errno, error, sqlstate. More...
 
struct  s_mysql_mysql_current_thread_reader
 A service to fetch the current thread id. More...
 
struct  s_mysql_mysql_debug_keyword_service
 A service to check if debug keyword status. More...
 
struct  s_mysql_mysql_debug_sync_service
 Enable capability to process debug_sync point from components. More...
 
struct  s_mysql_mysql_keyring_native_key_id
 A service to read native keybackend id. More...
 
struct  s_mysql_mysql_option_tracker_option
 Option tracker registration and deregistration services. More...
 
struct  s_mysql_mysql_option_tracker_usage
 Option tracker usage marker. More...
 
struct  s_mysql_mysql_query_attributes_iterator
 A service to fetch the query attributes for the current thread. More...
 
struct  s_mysql_mysql_query_attribute_string
 A service to fetch the query attribute value as a string. More...
 
struct  s_mysql_mysql_query_attribute_isnull
 A service to fetch the query attribute null flag. More...
 
struct  s_mysql_mysql_scheduler
 The Scheduler queueing interface. More...
 
struct  s_mysql_my_signal_handler
 A service to register/deregister a signal handler function callback. More...
 
struct  s_mysql_mysql_stmt_factory
 A service that provides the API to create, and deallocate a statement. More...
 
struct  s_mysql_mysql_stmt_execute
 A service that provides the API to execute prepared statements. More...
 
struct  s_mysql_mysql_stmt_bind
 A service that provides the API to bind the parameters in prepared statements. More...
 
struct  s_mysql_mysql_stmt_result
 A service that provides the API to manage and get info about a result set including fetch row(s) from a result set, get next result set. More...
 
struct  s_mysql_mysql_stmt_diagnostics
 A service that provides the API to get the errors and warnings including fetching the warning, getting error/warning number, error/warning level, error/warning message, SQL state. More...
 
struct  s_mysql_mysql_stmt_metadata
 A service that provides the API to get information about statement metadata including the number of the parameters in a prepared statement and their metatdata. More...
 
struct  s_mysql_mysql_stmt_resultset_metadata
 A service that provides the API to get information about a field or column in a result set including get the number of fields, fetch a field and get information of a field. More...
 
struct  s_mysql_mysql_stmt_get_integer
 A service that provides the API for get integer. More...
 
struct  s_mysql_mysql_stmt_get_unsigned_integer
 A service that provides the API for get unsigned integer. More...
 
struct  s_mysql_mysql_stmt_get_double
 A service that provides the API for get double. More...
 
struct  s_mysql_mysql_stmt_get_time
 A service that provides the API for get time value from a row. More...
 
struct  s_mysql_mysql_stmt_get_string
 A service that provides the API for get string value from a row. More...
 
struct  s_mysql_mysql_status_variable_string
 Service to read the value of a status variable as a string. More...
 
struct  s_mysql_mysql_system_variable_update_string
 Service to set the value of system variables. More...
 
struct  s_mysql_mysql_system_variable_reader
 Fetches the session/global/persist value of a system variable. More...
 
struct  s_mysql_mysql_system_variable_update_integer
 Service to set the value of integer system variables. More...
 
struct  s_mysql_mysql_system_variable_update_default
 Service to set the default value of system variables. More...
 
struct  s_mysql_mysql_thd_attributes
 THD Attributes service allows to obtain data associated with the THD object, which keeps various attributes of the user session. More...
 
struct  s_mysql_psi_tls_channel_v1
 Service for instrumentation of TLS channel in performance schema. More...
 
struct  s_mysql_reference_caching_channel
 A reference caching channel service. More...
 
struct  s_mysql_replication_applier_metrics
 A service that allows you to extract stats from the replica applier. More...
 
struct  s_mysql_thread_cleanup_handler
 A service to cleanup thread resource. More...
 
struct  s_mysql_thread_cleanup_register
 Thread cleanup service allows a OS thread to free resources allocated for specific thread, during thread exit. More...
 
struct  s_mysql_validate_password
 Interfaces to enforce a password policy. More...
 
struct  s_mysql_validate_password_changed_characters
 Service to enforce that new password contains N different characters compared to existing password. More...
 

Typedefs

typedef struct s_mysql_mysql_audit_api_connection mysql_service_mysql_audit_api_connection_t
 A service to generate Audit API events of the connection class (MYSQL_AUDIT_CONNECTION_CLASS). More...
 
typedef struct s_mysql_mysql_audit_api_connection_with_error mysql_service_mysql_audit_api_connection_with_error_t
 A service to generate Audit API events of the connection class (MYSQL_AUDIT_CONNECTION_CLASS) with the explicitly specified error code value. More...
 
typedef struct s_mysql_component_sys_variable_register mysql_service_component_sys_variable_register_t
 Service to register variable and get variable value. More...
 
typedef struct s_mysql_component_sys_variable_unregister mysql_service_component_sys_variable_unregister_t
 Service to unregister variable. More...
 
typedef struct s_mysql_component_thread_cleanup_handler mysql_service_component_thread_cleanup_handler_t
 A service to cleanup component thread resource. More...
 
typedef struct s_mysql_dynamic_loader_services_loaded_notification mysql_service_dynamic_loader_services_loaded_notification_t
 A service to notify consumers about services loaded through dynamic loader. More...
 
typedef struct s_mysql_dynamic_loader_services_unload_notification mysql_service_dynamic_loader_services_unload_notification_t
 A service to notify consumers about services to be unloaded through dynamic loader. More...
 
typedef struct s_mysql_dynamic_privilege_register mysql_service_dynamic_privilege_register_t
 A service to register and unregister dynamic privileges. More...
 
typedef struct s_mysql_dynamic_privilege_deprecation mysql_service_dynamic_privilege_deprecation_t
 A service to register and unregister dynamic privileges as deprecated. More...
 
typedef struct s_mysql_group_replication_flow_control_metrics_service mysql_service_group_replication_flow_control_metrics_service_t
 A service that retrieve extra flow control stats from a member. More...
 
typedef struct s_mysql_group_replication_message_service_send mysql_service_group_replication_message_service_send_t
 A service that sends content agnostic messages from a member to the group. More...
 
typedef struct s_mysql_group_replication_status_service_v1 mysql_service_group_replication_status_service_v1_t
 A service to get the status of a member of Group Replication. More...
 
typedef struct s_mysql_host_application_signal mysql_service_host_application_signal_t
 A service to deliver a signal to host application. More...
 
typedef struct s_mysql_mysql_keyring_iterator mysql_service_mysql_keyring_iterator_t
 Keyring iterator component service definition, which enables to iterate over items stored within currently used keyring. More...
 
typedef struct s_mysql_external_program_capability_query mysql_service_external_program_capability_query_t
 A service to query various properties/capabilities of the implementer of s_mysql_external_program_execution service. More...
 
typedef struct s_mysql_external_program_execution mysql_service_external_program_execution_t
 A service to setup and execute multi-lingual stored procedures. More...
 
typedef struct s_mysql_mysql_admin_session mysql_service_mysql_admin_session_t
 A service to create an "admin" session that's not a subject to max connection count limits. More...
 
typedef struct s_mysql_mysql_audit_print_service_double_data_source mysql_service_mysql_audit_print_service_double_data_source_t
 Audit print service allows to obtain data of the double type associated with the THD object, which keeps various data of the user session. More...
 
typedef struct s_mysql_mysql_audit_print_service_longlong_data_source mysql_service_mysql_audit_print_service_longlong_data_source_t
 Audit print service allows to obtain data of the long long type associated with the THD object, which keeps various data of the user session. More...
 
typedef struct s_mysql_mysql_authentication_registration mysql_service_mysql_authentication_registration_t
 A service to do registration of fido device. More...
 
typedef struct s_mysql_mysql_text_consumer_factory_v1 mysql_service_mysql_text_consumer_factory_v1_t
 An implementation of these services will be called as the data resulting from calling mysql_query() service are produced by the server. More...
 
typedef struct s_mysql_mysql_text_consumer_metadata_v1 mysql_service_mysql_text_consumer_metadata_v1_t
 A service that provides the apis for start_result_metadata, field_metadata, and end_result_metadata. More...
 
typedef struct s_mysql_mysql_text_consumer_row_factory_v1 mysql_service_mysql_text_consumer_row_factory_v1_t
 A service that provides the apis for start_row, abort_row and end_row. More...
 
typedef struct s_mysql_mysql_text_consumer_error_v1 mysql_service_mysql_text_consumer_error_v1_t
 A service that provides the apis for handle_ok, handle_error and error. More...
 
typedef struct s_mysql_mysql_text_consumer_get_null_v1 mysql_service_mysql_text_consumer_get_null_v1_t
 A service that provides the apis for get_null. More...
 
typedef struct s_mysql_mysql_text_consumer_get_integer_v1 mysql_service_mysql_text_consumer_get_integer_v1_t
 A service that provides the apis for get_integer. More...
 
typedef struct s_mysql_mysql_text_consumer_get_longlong_v1 mysql_service_mysql_text_consumer_get_longlong_v1_t
 A service that provides the apis for get_longlong. More...
 
typedef struct s_mysql_mysql_text_consumer_get_decimal_v1 mysql_service_mysql_text_consumer_get_decimal_v1_t
 A service that provides the apis for get_decimal. More...
 
typedef struct s_mysql_mysql_text_consumer_get_double_v1 mysql_service_mysql_text_consumer_get_double_v1_t
 A service that provides the apis for get_double. More...
 
typedef struct s_mysql_mysql_text_consumer_get_date_time_v1 mysql_service_mysql_text_consumer_get_date_time_v1_t
 A service that provides the apis for get_date, get_time and get_datatime. More...
 
typedef struct s_mysql_mysql_text_consumer_get_string_v1 mysql_service_mysql_text_consumer_get_string_v1_t
 A service that provides the apis for get_string. More...
 
typedef struct s_mysql_mysql_text_consumer_client_capabilities_v1 mysql_service_mysql_text_consumer_client_capabilities_v1_t
 A service that provides the apis for client_capabilities. More...
 
typedef struct s_mysql_mysql_command_factory mysql_service_mysql_command_factory_t
 A service that provides the apis for mysql command init, info, connect, reset, close, commit, auto_commit and rollback. More...
 
typedef struct s_mysql_mysql_command_thread mysql_service_mysql_command_thread_t
 A service that provides the apis for mysql command session thread init and thread end. More...
 
typedef struct s_mysql_mysql_command_options mysql_service_mysql_command_options_t
 A service that provides the apis for mysql command get_option and set_option. More...
 
typedef struct s_mysql_mysql_command_query mysql_service_mysql_command_query_t
 A service that provides the apis for mysql command query and affected_rows. More...
 
typedef struct s_mysql_mysql_command_query_result mysql_service_mysql_command_query_result_t
 A service that provides the apis for mysql command, store_result, free_result, more_results, next_result, result_metadata and fetch_row. More...
 
typedef struct s_mysql_mysql_command_field_info mysql_service_mysql_command_field_info_t
 A service that provides the apis for mysql command field info, fetch_field, num_fields, fetch_fields and field_count. More...
 
typedef struct s_mysql_mysql_command_field_metadata mysql_service_mysql_command_field_metadata_t
 Fetch the metadata of a service. More...
 
typedef struct s_mysql_mysql_command_error_info mysql_service_mysql_command_error_info_t
 A service that provides the apis for mysql command error info, mysql_errno, error, sqlstate. More...
 
typedef const char * my_h_connection_attributes_iterator
 A service to read the connection attributes from the current session It provides a read-only iterator over the attributes. More...
 
typedef struct s_mysql_mysql_current_thread_reader mysql_service_mysql_current_thread_reader_t
 A service to fetch the current thread id. More...
 
typedef struct s_mysql_mysql_debug_keyword_service mysql_service_mysql_debug_keyword_service_t
 A service to check if debug keyword status. More...
 
typedef struct s_mysql_mysql_debug_sync_service mysql_service_mysql_debug_sync_service_t
 Enable capability to process debug_sync point from components. More...
 
typedef struct s_mysql_mysql_keyring_native_key_id mysql_service_mysql_keyring_native_key_id_t
 A service to read native keybackend id. More...
 
typedef struct s_mysql_mysql_option_tracker_option mysql_service_mysql_option_tracker_option_t
 Option tracker registration and deregistration services. More...
 
typedef struct s_mysql_mysql_option_tracker_usage mysql_service_mysql_option_tracker_usage_t
 Option tracker usage marker. More...
 
typedef struct s_mysql_mysql_query_attributes_iterator mysql_service_mysql_query_attributes_iterator_t
 A service to fetch the query attributes for the current thread. More...
 
typedef struct s_mysql_mysql_query_attribute_string mysql_service_mysql_query_attribute_string_t
 A service to fetch the query attribute value as a string. More...
 
typedef struct s_mysql_mysql_query_attribute_isnull mysql_service_mysql_query_attribute_isnull_t
 A service to fetch the query attribute null flag. More...
 
typedef struct s_mysql_mysql_scheduler mysql_service_mysql_scheduler_t
 The Scheduler queueing interface. More...
 
typedef struct s_mysql_my_signal_handler mysql_service_my_signal_handler_t
 A service to register/deregister a signal handler function callback. More...
 
typedef struct s_mysql_mysql_stmt_factory mysql_service_mysql_stmt_factory_t
 A service that provides the API to create, and deallocate a statement. More...
 
typedef struct s_mysql_mysql_stmt_execute mysql_service_mysql_stmt_execute_t
 A service that provides the API to execute prepared statements. More...
 
typedef struct s_mysql_mysql_stmt_bind mysql_service_mysql_stmt_bind_t
 A service that provides the API to bind the parameters in prepared statements. More...
 
typedef struct s_mysql_mysql_stmt_result mysql_service_mysql_stmt_result_t
 A service that provides the API to manage and get info about a result set including fetch row(s) from a result set, get next result set. More...
 
typedef struct s_mysql_mysql_stmt_diagnostics mysql_service_mysql_stmt_diagnostics_t
 A service that provides the API to get the errors and warnings including fetching the warning, getting error/warning number, error/warning level, error/warning message, SQL state. More...
 
typedef struct s_mysql_mysql_stmt_metadata mysql_service_mysql_stmt_metadata_t
 A service that provides the API to get information about statement metadata including the number of the parameters in a prepared statement and their metatdata. More...
 
typedef struct s_mysql_mysql_stmt_resultset_metadata mysql_service_mysql_stmt_resultset_metadata_t
 A service that provides the API to get information about a field or column in a result set including get the number of fields, fetch a field and get information of a field. More...
 
typedef struct s_mysql_mysql_stmt_get_integer mysql_service_mysql_stmt_get_integer_t
 A service that provides the API for get integer. More...
 
typedef struct s_mysql_mysql_stmt_get_unsigned_integer mysql_service_mysql_stmt_get_unsigned_integer_t
 A service that provides the API for get unsigned integer. More...
 
typedef struct s_mysql_mysql_stmt_get_double mysql_service_mysql_stmt_get_double_t
 A service that provides the API for get double. More...
 
typedef struct s_mysql_mysql_stmt_get_time mysql_service_mysql_stmt_get_time_t
 A service that provides the API for get time value from a row. More...
 
typedef struct s_mysql_mysql_stmt_get_string mysql_service_mysql_stmt_get_string_t
 A service that provides the API for get string value from a row. More...
 
typedef struct s_mysql_mysql_status_variable_string mysql_service_mysql_status_variable_string_t
 Service to read the value of a status variable as a string. More...
 
typedef struct s_mysql_mysql_system_variable_update_string mysql_service_mysql_system_variable_update_string_t
 Service to set the value of system variables. More...
 
typedef struct s_mysql_mysql_system_variable_reader mysql_service_mysql_system_variable_reader_t
 Fetches the session/global/persist value of a system variable. More...
 
typedef struct s_mysql_mysql_system_variable_update_integer mysql_service_mysql_system_variable_update_integer_t
 Service to set the value of integer system variables. More...
 
typedef struct s_mysql_mysql_system_variable_update_default mysql_service_mysql_system_variable_update_default_t
 Service to set the default value of system variables. More...
 
typedef struct s_mysql_mysql_thd_attributes mysql_service_mysql_thd_attributes_t
 THD Attributes service allows to obtain data associated with the THD object, which keeps various attributes of the user session. More...
 
typedef struct s_mysql_psi_tls_channel_v1 mysql_service_psi_tls_channel_v1_t
 Service for instrumentation of TLS channel in performance schema. More...
 
typedef struct s_mysql_reference_caching_channel mysql_service_reference_caching_channel_t
 A reference caching channel service. More...
 
typedef struct s_mysql_replication_applier_metrics mysql_service_replication_applier_metrics_t
 A service that allows you to extract stats from the replica applier. More...
 
typedef struct s_mysql_thread_cleanup_handler mysql_service_thread_cleanup_handler_t
 A service to cleanup thread resource. More...
 
typedef struct s_mysql_thread_cleanup_register mysql_service_thread_cleanup_register_t
 Thread cleanup service allows a OS thread to free resources allocated for specific thread, during thread exit. More...
 
typedef struct s_mysql_validate_password mysql_service_validate_password_t
 Interfaces to enforce a password policy. More...
 
typedef struct s_mysql_validate_password_changed_characters mysql_service_validate_password_changed_characters_t
 Service to enforce that new password contains N different characters compared to existing password. More...
 

Detailed Description

This is a group of all component service APIs.

See A Service and a Service Implementation for explanation of what a component service is

Typedef Documentation

◆ my_h_connection_attributes_iterator

A service to read the connection attributes from the current session It provides a read-only iterator over the attributes.

This is some example code to use the iterator:

// at init time. try to reuse the service handles as much as possible
"mysql_current_thread_reader", m_reg_srv);
my_service<SERVICE_TYPE(mysql_connection_attributes_iterator)> service(
"mysql_connection_attributes_iterator", m_reg_srv);
if (!service.is_valid() || !thd_reader.is_valid) {
return; //error
}
...
// at parse time
MYSQL_THD thd;
if (thd_reader->get(&thd))
return; //error
const char *charset_string;
const CHARSET_INFO *charset = nullptr;
if (service->init(thd, &iterator)) return; // error
while (!service->get(thd, &iterator, &name.str, &name.length, &value.str,
&value.length, &charset_string)) {
// Do something with name and value
}
service->deinit(iterator);
Wraps my_h_service struct conforming ABI into RAII C++ object with ability to cast to desired service...
Definition: my_service.h:35
const char * my_h_connection_attributes_iterator
A service to read the connection attributes from the current session It provides a read-only iterator...
Definition: mysql_connection_attributes_iterator.h:79
const std::string charset("charset")
const mysql_service_mysql_current_thread_reader_t * mysql_current_thread_reader
Definition: rewriter_plugin.cc:63
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
case opt name
Definition: sslopt-case.h:29
Definition: m_ctype.h:421
Definition: mysql_lex_string.h:40
const char * str
Definition: mysql_lex_string.h:41
size_t length
Definition: mysql_lex_string.h:42

◆ mysql_service_component_sys_variable_register_t

Service to register variable and get variable value.

See also
mysql_component_sys_variable_imp

◆ mysql_service_component_sys_variable_unregister_t

Service to unregister variable.

Make sure to call this for each variable registered.

See also
mysql_service_component_sys_variable_unregister_t

◆ mysql_service_component_thread_cleanup_handler_t

A service to cleanup component thread resource.

◆ mysql_service_dynamic_loader_services_loaded_notification_t

A service to notify consumers about services loaded through dynamic loader.

See also
The convenience class weak_service_reference

◆ mysql_service_dynamic_loader_services_unload_notification_t

A service to notify consumers about services to be unloaded through dynamic loader.

◆ mysql_service_dynamic_privilege_deprecation_t

A service to register and unregister dynamic privileges as deprecated.

Privilege names are in ASCII.

See also
mysql_audit_api_connection_imp

◆ mysql_service_dynamic_privilege_register_t

A service to register and unregister dynamic privileges.

Use it to add new privileges to the dynamic list.

Privilege names are in ASCII.

See also
mysql_audit_api_connection_imp

◆ mysql_service_external_program_capability_query_t

A service to query various properties/capabilities of the implementer of s_mysql_external_program_execution service.

◆ mysql_service_external_program_execution_t

A service to setup and execute multi-lingual stored procedures.

◆ mysql_service_group_replication_flow_control_metrics_service_t

A service that retrieve extra flow control stats from a member.

This only works if the component is on a server with group replication running.

SERVICE_TYPE(registry) *plugin_registry = mysql_plugin_registry_acquire();
my_service<SERVICE_TYPE(group_replication_flow_control_metrics_service)> svc(
"group_replication_message_service_send", plugin_registry);
uint64_t value;
if (svc.is_valid()) {
bool error = svc->gr_flow_control_throttle_count(&value);
}
void error(const char *format,...)
const mysql_service_registry_t * mysql_plugin_registry_acquire()
Returns a new reference to the "registry" service.
Definition: plugin_registry_service.cc:47

◆ mysql_service_group_replication_message_service_send_t

A service that sends content agnostic messages from a member to the group.

This only works if the component is on a server with group replication running and the member state is ONLINE. If server isn't ONLINE message won't be deliver.

After message sent to all members of the group, all components that have registered group_replication_message_service_recv service will be notified.

SERVICE_TYPE(registry) *plugin_registry = mysql_plugin_registry_acquire();
my_service<SERVICE_TYPE(group_replication_message_service_send)> svc(
"group_replication_message_service_send", plugin_registry);
if (svc.is_valid()) {
bool error = svc->send("tag", "payload", sizeof("payload"));
}

◆ mysql_service_group_replication_status_service_v1_t

A service to get the status of a member of Group Replication.

This is only available if the component is on a server with Group Replication plugin installed.

SERVICE_TYPE(registry) *plugin_registry = mysql_plugin_registry_acquire();
my_service<SERVICE_TYPE(group_replication_status_service_v1)> svc(
"group_replication_status_service_v1", plugin_registry);
if (svc.is_valid()) {
bool error = svc->...
}

◆ mysql_service_host_application_signal_t

A service to deliver a signal to host application.

Typically there'll be just one implementation of this by the main application.

Other parties interested in listening to shutdown may override the default implementation with a broadcast one and have multiple implementations receiving the shutdown signal. Or do message queueing to a set of background threads etc.

See also
mysql_component_host_application_signal_imp

◆ mysql_service_my_signal_handler_t

A service to register/deregister a signal handler function callback.

The server component signal handler will call this callback if a signal occurs. The callback needs to be signal reentrant safe code. Otherwise no guaranees on what happens.

Usage example: auto register_signal_handler_callback(my_signal_handler_callback_t callback) -> bool { SERVICE_PLACEHOLDER(my_signal_handler)->add(SIGSEGV, callback) == 0; } auto unregister_signal_handler_callback(my_signal_handler_callback_t callback) -> bool { return SERVICE_PLACEHOLDER(my_signal_handler)->remove(SIGSEGV, callback) == 0; }

auto handle_segfault_signal(int signum) { Code to handle segfault ... }

If this is used inside another component, at component init(): register_signal_handler_callback(&handle_segfault_signal)

At component deinit(): unregister_signal_handler_callback(&handle_segfault_signal)

See also
my_signal_handler_imp

◆ mysql_service_mysql_admin_session_t

A service to create an "admin" session that's not a subject to max connection count limits.

This service is an extension to the sessions plugin service suite. The MYSQL_SESSION references are compatible with the plugin service.

See also
mysql_component_mysql_admin_session_imp

◆ mysql_service_mysql_audit_api_connection_t

A service to generate Audit API events of the connection class (MYSQL_AUDIT_CONNECTION_CLASS).

The emit method generates the event in the synchronous way, causing all subscribers to receive it.

See also
mysql_audit_api_connection_imp

◆ mysql_service_mysql_audit_api_connection_with_error_t

A service to generate Audit API events of the connection class (MYSQL_AUDIT_CONNECTION_CLASS) with the explicitly specified error code value.

This service should ONLY be used if we cannot set the THD's Statement Diagnostic Area result code, which is passed along the audit notification chain. The preferred way of generating the event is to rely on THD's internal data as much as possible (mysql_audit_api_connection service)

The emit method generates the event in the synchronous way, causing all subscribers to receive it.

See also
mysql_audit_api_connection_imp

◆ mysql_service_mysql_audit_print_service_double_data_source_t

Audit print service allows to obtain data of the double type associated with the THD object, which keeps various data of the user session.

It also allows to obtain data not necessarily bound with the user session.

Currently, following data is supported:

  • Query time ("query_time") Query execution time [seconds].
  • Rows sent ("rows_sent") Row count sent to the client as a result.
  • Rows examined ("rows_examined") Row count accessed during the query.
  • Bytes received ("bytes_received") Byte count received from the client.
  • Bytes sent ("bytes_sent") Byte count sent to the client.

Initialization

The service can be instantiated using the registry service with the "mysql_audit_print_service_double_data_source" name.

my_service<SERVICE_TYPE(mysql_audit_print_service_double_data_source)>
svc("mysql_audit_print_service_double_data_source", registry);
if (svc.is_valid()) {
// The service is ready to be used
}

Query Time

Query Time represents query execution time in seconds.

double value;
svc->get(m_thd, "query_time", &value);

◆ mysql_service_mysql_audit_print_service_longlong_data_source_t

Audit print service allows to obtain data of the long long type associated with the THD object, which keeps various data of the user session.

It also allows to obtain data not necessarily bound with the user session.

Currently, following data is supported:

  • Query time ("query_time") Query execution time [microseconds].
  • Rows sent ("rows_sent") Row count sent to the client as a result.
  • Rows examined ("rows_examined") Row count accessed during the query.
  • Bytes received ("bytes_received") Byte count received from the client.
  • Bytes sent ("bytes_sent") Byte count sent to the client.

Initialization

The service can be instantiated using the registry service with the "mysql_audit_print_service_double_data_source" name.

my_service<SERVICE_TYPE(mysql_audit_print_service_long_long_data_source)>
svc("mysql_audit_print_service_long_long_data_source", registry);
if (svc.is_valid()) {
// The service is ready to be used
}

Query Time

Query Time represents query execution time in microseconds.

long long value;
svc->get(m_thd, "query_time", &value);

◆ mysql_service_mysql_authentication_registration_t

A service to do registration of fido device.

◆ mysql_service_mysql_command_error_info_t

A service that provides the apis for mysql command error info, mysql_errno, error, sqlstate.

◆ mysql_service_mysql_command_factory_t

A service that provides the apis for mysql command init, info, connect, reset, close, commit, auto_commit and rollback.

◆ mysql_service_mysql_command_field_info_t

A service that provides the apis for mysql command field info, fetch_field, num_fields, fetch_fields and field_count.

◆ mysql_service_mysql_command_field_metadata_t

Fetch the metadata of a service.

Usually used as follows:

◆ mysql_service_mysql_command_options_t

A service that provides the apis for mysql command get_option and set_option.

◆ mysql_service_mysql_command_query_result_t

A service that provides the apis for mysql command, store_result, free_result, more_results, next_result, result_metadata and fetch_row.

◆ mysql_service_mysql_command_query_t

A service that provides the apis for mysql command query and affected_rows.

◆ mysql_service_mysql_command_thread_t

A service that provides the apis for mysql command session thread init and thread end.

◆ mysql_service_mysql_current_thread_reader_t

A service to fetch the current thread id.

Use in conjunction with all the related services that operate on thread ids

See also
mysql_component_mysql_current_thread_reader_imp

◆ mysql_service_mysql_debug_keyword_service_t

A service to check if debug keyword status.

The debug keywords are used to implement various functionality for debugging. See my_dbug.h for more info. One of the functionality is DBUG_EXECUTE_IF.

This service lookup_debug_keyword() is used to implement DBUG_EXECUTE_IF for use in components. The DBUG_EXECUTE_IF is implemented in util/debug_execute_if.h

The usage remains the same way as used in server. E.g., DBUG_EXECUTE_IF("debug point", { ...code... return false; });

◆ mysql_service_mysql_debug_sync_service_t

Enable capability to process debug_sync point from components.

MySQL server provides DEBUG_SYNC macro to enable controlled testing. This service makes the same functionality to component.

The usage remains the same way as used in server. E.g., DEBUG_SYNC("debug sync point");

◆ mysql_service_mysql_keyring_iterator_t

Keyring iterator component service definition, which enables to iterate over items stored within currently used keyring.

my_service<SERVICE_TYPE(mysql_keyring_iterator)> service(
"mysql_keyring_iterator.mysql_server", m_reg_srv);
if (!service.is_valid()) {
return;
}
my_h_keyring_iterator iterator = nullptr;
if (service->init(&iterator)) {
return;
}
char key_id[64];
char user_id[64];
while (iterator != nullptr && service->get(iterator, key_id, sizeof(key_id)
user_id, sizeof(user_id))
== 0) {
// Do something with key and user_id values.
}
service->deinit(iterator);
struct my_h_keyring_iterator_imp * my_h_keyring_iterator
Definition: keyring_iterator_service.h:30

◆ mysql_service_mysql_keyring_native_key_id_t

A service to read native keybackend id.

Typically there'll be just one implementation of this by the main application.

◆ mysql_service_mysql_option_tracker_option_t

Option tracker registration and deregistration services.

This is a service that will allow registering an option. Each option has a name. The name is UTF8mb4 and is unique in the list. Manipulating the option list is an "expesive" operation since there is a global lock involved.

Each code container (a component or a plugin) should register its options during its initialization and should unregister them during its deinitialization.

◆ mysql_service_mysql_option_tracker_usage_t

Option tracker usage marker.

Sets usage data for a given option. Internally stores into the system table.

Cluster ID is set to empty.

It gets the value for server_id from the system variable server_uuid.

◆ mysql_service_mysql_query_attribute_isnull_t

A service to fetch the query attribute null flag.

Use in conjunction with mysql_query_atrributes_iterator service

See also
mysql_component_mysql_query_attributes_imp

◆ mysql_service_mysql_query_attribute_string_t

A service to fetch the query attribute value as a string.

Use in conjunction with mysql_query_atrributes_iterator service

See also
mysql_component_mysql_query_attributes_imp

◆ mysql_service_mysql_query_attributes_iterator_t

A service to fetch the query attributes for the current thread.

Use in conjunction with all the related services that operate on thread ids

See also
mysql_component_mysql_query_attributes_imp

◆ mysql_service_mysql_scheduler_t

The Scheduler queueing interface.

This is a service that will allow registering a callback to be called every X seconds.

Each callback has a name. And a comment for the DBA to check.

A caller registers a callback together with its argument and gets a handle back. The callback will be put in rotation immediately and will be called after the defined interval. And it will keep being called until it's unregisterered using the handle.

Passing an argument is useful if you are to reuse the callback function to operate on many different states through registering it in multiple scheduled events. Having the argument passed down from the registering code to the callback saves the need of the callback to consult a global structure in a multi- thread safe fashion.

Warning
Keep the runnable function SHORT! Or design a way for it to be graciously shut down through a flag inside the argument.

To use it one would do something like this:

bool sheduled_callback(mysql_scheduler_runnable_handle handle, void *arg) {
int *ctr = reinterpret_cast<std::atomic<int> *>(arg);
*ctr++;
}
REQUIRES_SERVICE(mysql_scheduler);
int caller() {
std::atomic<int> data= 0;
mysql_service_mysql_scheduler->create(
&handle, sheduled_callback,
(void *)&data,
"gizmo", "This is a sheduled task to call gizmo",
10);
....
mysql_service_mysql_scheduler->destroy(handle);
handle = nullptr;
}
#define REQUIRES_SERVICE(service)
Adds a Service requirement with a pointer to placeholder to the list of components.
Definition: component_implementation.h:305
struct mysql_scheduler_runnable_handle_imp * mysql_scheduler_runnable_handle
The hande to the runnable, to use in deregistration.
Definition: mysql_scheduler_bits.h:30
static int handle(int sql_errno, const char *sqlstate, const char *message, void *state)
Bridge function between the C++ API offered by this module and the C API of the parser service.
Definition: services.cc:64
See also
mysql_scheduler_runnable_handle, mysql_scheduler_runnable_function

◆ mysql_service_mysql_status_variable_string_t

Service to read the value of a status variable as a string.

Used approximately as follows:

my_h_string value = nullptr;
bool get_global = true; // or false
MYSQL_THD thd = nullptr; // use a temp thd
const char *name = "gizmo";
char buffer[1024];
const char *charset= "utf8mb4";
// try to get the current thd if there is one
if (!get_global && mysql_service_mysql_current_thread_reader->get(&thd)) {
// failed to get the current THD
*is_null = 1;
*error = 1;
return nullptr;
}
if (!mysql_service_mysql_status_variable_string->get(thd, name, get_global,
&str) && str && !mysql_service_mysql_string_converter->convert_to_buffer( str,
buffer, sizeof(buffer) - 1, charset)) {
mysql_service_mysql_string_factory->destroy(str);
// the value is in buffer
}
// wasn't able to get the value. do cleanup
if (str) mysql_service_mysql_string_factory->destroy(str);
#define MYSQL_THD
Definition: backup_page_tracker.h:38
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Definition: mysql_string_service.cc:60
See also
mysql_status_variable_reader_imp

◆ mysql_service_mysql_stmt_bind_t

A service that provides the API to bind the parameters in prepared statements.

Usage example:

For first parameter SERVICE_PLACEHOLDER(mysql_stmt_bind)->bind_param(statement, 0, false, MYSQL_TYPE_LONG, false, 4, 1, nullptr, 0);

◆ mysql_service_mysql_stmt_diagnostics_t

A service that provides the API to get the errors and warnings including fetching the warning, getting error/warning number, error/warning level, error/warning message, SQL state.

In addition, for INSERT/UPDATE/DELETE, the service provides the API to get the number of affected rows and last insert ID.

Usage example: For INSERT/UPDATE/DELETE/... statements, to get the number of affected rows and last insert id.

uint64_t num_affected_rows;
SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->affected_rows(statement,
                                                  &num_affected_rows)

auto last_insert_id = uint64_t{};
SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->insert_id(statement,
                                                    &last_insert_id)

To get the diagnostics information auto error_number = uint64_t{}; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->error_id(statement, &error_number); char const *sql_errmsg = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->error(statement, &sql_errmsg); char const *sql_state = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->get_sql_state(statement, &sql_state); auto warning_count = uint32_t{}; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->num_warnings(statement, &warning_count);

for(size_t warn_index = 0; warn_index < warning_count; warn_index++) { my_h_warning warning = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->get_warning(statement, warn_index, &warning); auto level = uint32_t{}; SERVICE_PLACEHOLDER(mysql_stmt_diagnostics)->warning_level(warning, &level);

Similarly for code and message }

◆ mysql_service_mysql_stmt_execute_t

A service that provides the API to execute prepared statements.

Usage example: Prepare a statement my_h_statement statement = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_factory)->init(&statement); SERVICE_PLACEHOLDER(mysql_stmt_execute)->prepare("SELECT * FROM my_table WHERE col_c = ?", statement) SERVICE_PLACEHOLDER(mysql_stmt_bind)->bind_param(statement, 0, false, MYSQL_TYPE_LONG, false, 4, 1, nullptr, 0);

To reset the parameter to bind it with new values SERVICE_PLACEHOLDER(mysql_stmt_execute)->reset(statement)

Execute the statement SERVICE_PLACEHOLDER(mysql_stmt_execute)->execute(statement)

◆ mysql_service_mysql_stmt_factory_t

A service that provides the API to create, and deallocate a statement.

Note
Users of the service can set the expected charset e.g SERVICE_PLACEHOLDER(mysql_stmt_attributes)->set("charset_name", "utf8mb4"); The service expects all the input strings to be in this charset and all the output strings from the service will be in this charset. The statement can be either a regular or a prepared statement.

Usage example for prepared statement: my_h_statement statement = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_factory)->init(&statement);

SERVICE_PLACEHOLDER(mysql_stmt_attributes)->set("charset_name", "utf8mb4");

SERVICE_PLACEHOLDER(mysql_stmt_execute)->prepare("SELECT * FROM ?", statement);

uint32_t parameter_count; SERVICE_PLACEHOLDER(mysql_stmt_metadata)->param_count(statement, &parameter_count);

For first parameter SERVICE_PLACEHOLDER(mysql_stmt_bind)->bind_param(statement, 0, false, MYSQL_TYPE_LONG, false, 4, 1, nullptr, 0);

SERVICE_PLACEHOLDER(mysql_stmt_execute)->execute(statement)

my_h_row row = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_result)->fetch(statement, &row); SERVICE_PLACEHOLDER(mysql_stmt_factory)->close(statement)

Usage example for regular statement: my_h_statement statement = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_factory)->init(&statement);

SERVICE_PLACEHOLDER(mysql_stmt_attributes)->set("charset_name", "utf8mb4");

SERVICE_PLACEHOLDER(mysql_stmt_execute_direct)->execute("SELECT * FROM my_table", statement);

my_h_row row = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_result)->fetch(statement, &row); SERVICE_PLACEHOLDER(mysql_stmt_factory)->close(statement)

◆ mysql_service_mysql_stmt_get_double_t

A service that provides the API for get double.

◆ mysql_service_mysql_stmt_get_integer_t

A service that provides the API for get integer.

Usage example:

autp int_val = int64_t{}; bool is_null; SERVICE_PLACEHOLDER(mysql_stmt_get_integer)->get(row, column_index, &int_val, &is_null)

◆ mysql_service_mysql_stmt_get_string_t

A service that provides the API for get string value from a row.

auto result = mysql_cstring_with_length{}; auto is_null = false; if (SERVICE_PLACEHOLDER(mysql_stmt_get_string) ->get(row, column_index, &result, &is_null) == MYSQL_FAILURE) { return {}; }

◆ mysql_service_mysql_stmt_get_time_t

A service that provides the API for get time value from a row.

auto result = Time_t{}; auto is_null = false;

if (SERVICE_PLACEHOLDER(mysql_stmt_get_time) ->get(row, column_index, &result.hour, &result.minute, &result.second, &result.microseconds, &result.negative, &is_null) == MYSQL_FAILURE) return {};

◆ mysql_service_mysql_stmt_get_unsigned_integer_t

A service that provides the API for get unsigned integer.

◆ mysql_service_mysql_stmt_metadata_t

A service that provides the API to get information about statement metadata including the number of the parameters in a prepared statement and their metatdata.

For prepared statement, to get the number of parameters uint64_t num_parameters; SERVICE_PLACEHOLDER(mysql_stmt_metadata)->param_count(statement, &num_parameters)

◆ mysql_service_mysql_stmt_result_t

A service that provides the API to manage and get info about a result set including fetch row(s) from a result set, get next result set.

A result set contains the result of an execution. It is a list of rows, each row is a list of values where each value corresponds to a column.

Usage example: Iterate over the rows in a result set for result set with data (num_fields != 0) For in-depth example, check test_execute_prepared_statement.cc and test_execute_regular_statement.cc my_h_row row = nullptr; do { SERVICE_PLACEHOLDER(mysql_stmt_result)->fetch(statement, &row); if (row == nullptr) { break; } Get data from a row using row services } while (true)

Iterate over result sets auto has_next_result_set = bool{}; do { SERVICE_PLACEHOLDER(mysql_stmt_result)->next_result(statement, &has_next_result_set); } while(has_next_result_set);

◆ mysql_service_mysql_stmt_resultset_metadata_t

A service that provides the API to get information about a field or column in a result set including get the number of fields, fetch a field and get information of a field.

More info: https://dev.mysql.com/doc/c-api/8.0/en/mysql-stmt-field-count.html

Usage example:

auto num_fields = uint32_t{}; SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)->field_count(statement, &num_fields);

my_h_field field = nullptr; for(size_t field_index = 0; field_index < num_fields; field_index++) { SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)->fetch_field(statement, field_index, &field);

char* field_name = nullptr; SERVICE_PLACEHOLDER(mysql_stmt_resultset_metadata)->field_info(field, "col_name", &field_name);

Do similarly for other field metadata }

◆ mysql_service_mysql_system_variable_reader_t

Fetches the session/global/persist value of a system variable.

This is an example of using the service:

Call this to get the session/global/persist value of a variable. You can access both the component variables (SELECT ["@@"][scope "."]component_name "." variable_name; where scope ::= SESSION | LOCAL | GLOBAL) and the "legacy" system variables (SELECT ["@@"][scope "."].variable_name; where scope ::= SESSION | LOCAL | GLOBAL) that are registered by the server component. To access the latter you need to pass "mysql_server" (lowercase) as a component name.

A pointer to the value is returned into the val input/output argument. And the length of the value (as applicable) is returned into the out_length_of_val argument.

In case when the user buffer was too small to copy the value, the call fails and needed buffer size is returned by 'out_length_of_val'.

Decide on a variable storage type among one of "GLOBAL" or "SESSION"

Typical use (char * variable):

char *value, buffer_for_value[160];
size_t value_length;
const char *type = "GLOBAL";
value= &buffer_for_value[0];
value_length= sizeof(buffer_for_value) - 1;
mysql_service_mysql_system_variable_reader->get(nullptr, type, "foo", "bar",
&value, &value_length);
printf("%.*s", (int) value_length, value);
To get the "SESSION" value the "hthd" should be passed :
MYSQL_THD hthd;
if (mysql_service_mysql_current_thread_reader->get(&hthd)) {
my_error("%s\n", "mysql_current_thread_reader get() api failed");
}
mysql_service_mysql_system_variable_reader->get(
hthd, "SESSION", "foo", "bar",
&value, &value_length);
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:216
static mysql_service_status_t get(THD **thd) noexcept
Definition: mysql_current_thread_reader_all_empty.cc:31
required string type
Definition: replication_group_member_actions.proto:34

◆ mysql_service_mysql_system_variable_update_default_t

Service to set the default value of system variables.

This is an example of using the service:

MYSQL_THD thd = nullptr;
if (!make_new_thread &&
mysql_service_mysql_current_thread_reader->get(&thd)) {
*error = 1;
return 0;
}
const char *cs = "latin1";
const char *base_input = "my_component"; //nullptr if not a component variable
const char *name_input = "my_variable";
const char *type = "PERSIST";
my_h_string base = nullptr, name = nullptr;
mysql_service_mysql_string_factory->create(&base);
mysql_service_mysql_string_factory->create(&name);
if ((base_input != nullptr &&
mysql_service_mysql_string_converter->convert_from_buffer(
&base, base_input, strlen(base_input), cs)) ||
mysql_service_mysql_string_converter->convert_from_buffer(
&name, name_input, strlen(name_input), cs)) {
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
*error = 1;
return 0;
}
if (mysql_service_mysql_system_variable_update_default->set(
thd, type, base, name))
*error = 1;
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
Definition: commit_order_queue.h:34
See also
mysql_system_variable_update_imp

◆ mysql_service_mysql_system_variable_update_integer_t

Service to set the value of integer system variables.

Passing non-NULL THD input to setter methods means that the operation will be executed within the scope of existing transaction, thus any operation side effects impacting transaction itself (for example it may generate an SQL error that it stores into the current THD). If using existing THD, security context of the thread is checked to make sure that required privileges exist. Passing NULL makes a temporary THD created as a execution context (and destroyed afterwards), i.e. no impacts on existing transactions. It doesn't make sense to change SESSION variable on a temporary THD, so this operation will generate error.

This is an example of using the service:

MYSQL_THD thd = nullptr;
if (!make_new_thread &&
mysql_service_mysql_current_thread_reader->get(&thd)) {
*error = 1;
return 0;
}
const char *cs = "latin1";
const char *base_input = "my_component"; //nullptr if not a component variable
const char *name_input = "my_variable";
const char *type = "SESSION";
long long value_signed = 100000;
unsigned long long value_unsigned = 500000;
my_h_string base = nullptr, name = nullptr;
mysql_service_mysql_string_factory->create(&base);
mysql_service_mysql_string_factory->create(&name);
if ((base_input != nullptr &&
mysql_service_mysql_string_converter->convert_from_buffer(
&base, base_input, strlen(base_input), cs)) ||
mysql_service_mysql_string_converter->convert_from_buffer(
&name, name_input, strlen(name_input), cs)) {
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
*error = 1;
return 0;
}
// example call for signed integer system variable type
if (mysql_service_mysql_system_variable_update_integer->set_signed(
thd, type, base, name, value_signed))
*error = 1;
// alternative call for unsigned integer type
if (mysql_service_mysql_system_variable_update_integer->set_unsigned(
thd, type, base, name, value_unsigned))
*error = 1;
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
See also
mysql_system_variable_update_imp

◆ mysql_service_mysql_system_variable_update_string_t

Service to set the value of system variables.

This is an example of using the service:

MYSQL_THD thd = nullptr;
if (!make_new_thread &&
mysql_service_mysql_current_thread_reader->get(&thd)) {
*error = 1;
return 0;
}
const char *cs = "latin1";
const char *base_input = "my_component"; //nullptr if not a component variable
const char *name_input = "my_variable";
const char *value_input = "value";
const char *type = "GLOBAL";
my_h_string base = nullptr, name = nullptr, value = nullptr;
mysql_service_mysql_string_factory->create(&base);
mysql_service_mysql_string_factory->create(&name);
mysql_service_mysql_string_factory->create(&value);
if ((base_input != nullptr &&
mysql_service_mysql_string_converter->convert_from_buffer(
&base, base_input, strlen(base_input), cs)) ||
mysql_service_mysql_string_converter->convert_from_buffer(
&name, name_input, strlen(name_input), cs) ||
mysql_service_mysql_string_converter->convert_from_buffer(
&value, value_input, strlen(value_input), cs) {
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
if (value) mysql_service_mysql_string_factory->destroy(value);
*error = 1;
return 0;
}
if (mysql_service_mysql_system_variable_update_string->set(thd, type,
base, name, value)) *error = 1;
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
if (value) mysql_service_mysql_string_factory->destroy(value);
if(!(yy_init))
Definition: lexyy.cc:1144
See also
mysql_system_variable_update_imp

◆ mysql_service_mysql_text_consumer_client_capabilities_v1_t

A service that provides the apis for client_capabilities.

◆ mysql_service_mysql_text_consumer_error_v1_t

A service that provides the apis for handle_ok, handle_error and error.

◆ mysql_service_mysql_text_consumer_factory_v1_t

An implementation of these services will be called as the data resulting from calling mysql_query() service are produced by the server.

Most often the default implementation of this service that will cache the data into a memory structure into the MYSQL handle will be used. But this will only work if the resultset expected is relatively small.

Note
The default implementation will allow accessing the data after the query execution. This will not be possible with a custom method.

If one wants to avoid the memory caching and process the data SAX style as they are returned by the SQL execution define, they should provide their own implementation of this service that will process the data differently at the time of their production.

A service that provides the apis for start and end.

◆ mysql_service_mysql_text_consumer_get_date_time_v1_t

A service that provides the apis for get_date, get_time and get_datatime.

◆ mysql_service_mysql_text_consumer_get_decimal_v1_t

A service that provides the apis for get_decimal.

◆ mysql_service_mysql_text_consumer_get_double_v1_t

A service that provides the apis for get_double.

and error.

◆ mysql_service_mysql_text_consumer_get_integer_v1_t

A service that provides the apis for get_integer.

◆ mysql_service_mysql_text_consumer_get_longlong_v1_t

A service that provides the apis for get_longlong.

◆ mysql_service_mysql_text_consumer_get_null_v1_t

A service that provides the apis for get_null.

◆ mysql_service_mysql_text_consumer_get_string_v1_t

A service that provides the apis for get_string.

◆ mysql_service_mysql_text_consumer_metadata_v1_t

A service that provides the apis for start_result_metadata, field_metadata, and end_result_metadata.

◆ mysql_service_mysql_text_consumer_row_factory_v1_t

A service that provides the apis for start_row, abort_row and end_row.

◆ mysql_service_mysql_thd_attributes_t

THD Attributes service allows to obtain data associated with the THD object, which keeps various attributes of the user session.

Currently, following attributes are supported:

  • Query Digest Text
  • Query Text
  • Host or IP
  • Schema
  • Command String ("command" of the return mysql_cstring_with_length type)
  • SQL Command String ("sql_command" of the return mysql_cstring_with_length type)
  • Query Character Set ("query_charset" of the return mysql_cstring_with_length type)

Initialization

The service can be instantiated using the registry service with the "mysql_thd_attributes" name.

svc("mysql_thd_attributes", registry);
if (svc.is_valid()) {
// The service is ready to be used
}
const mysql_service_mysql_thd_attributes_t * mysql_thd_attributes
Definition: rewriter_plugin.cc:59

Query Digest Text

Query Digest represents converted SQL statement to normalized form. The code below demonstrates how query digest can be obtained from the service.

mysql_thd_attributes->get(m_thd, "query_digest",
reinterpret_cast<void *>(&str));
mysql_service_status_t(* get)(THD *thd, const char *name, void *inout_pvalue)
Get THD attribute.
Definition: mysql_thd_attributes.h:143

The buffer can be fetched using the code below:

char buf[1024]; // buffer must be big enough to store the digest
mysql_string_converter->convert_to_buffer(str, buf, sizeof(buf), "utf8mb3");
Definition: buf0block_hint.cc:30

After the string content has been copied into another buffer, it must be destroyed:

mysql_string_factory->destroy(str);

Query Text

Query text represents complete SQL text currently being executed within a given session. The example code is identical to the one for Query Digest, the only difference is that attribute name "sql_text" should be used in this case.

Host or IP

Host or IP text contains host or IP (if host unavailable) belonging to a client associated with a given session. The example code is identical to the one for Query Digest, the only difference is that attribute name "host_or_ip" should be used in this case.

Schema

Schema text contains a name of database currently in use by a client associated with a given session. The example code is identical to the one for Query Digest, the only difference is that attribute name "schema" should be used in this case.

◆ mysql_service_psi_tls_channel_v1_t

Service for instrumentation of TLS channel in performance schema.

◆ mysql_service_reference_caching_channel_t

A reference caching channel service.

The goal of this service is to ensure that event producers spend a MINIMAL amount of time in the emitting code when there are no consumers of the produced events.

Terminology

An event consumer is an implementation of a component service. An event producer is a piece of code that wants to inform all currently registered event consumers about an event. A channel is a device that serves as a singleton of all reference caches for all threads that are to produce events. A reference cache is something each thread producing events must maintain for its lifetime and use it to find the references to event consumers it needs to call.

Typical lifetime of the event consumers

At init time the event consumer will register implementations of any of the services it's interested in receiving notifications for.

Then optionally it might force a channel invalidation to make sure all existing event producers will start sending notifications to it immediately. Or it can just sit and wait for the natural producer's reference cache refresh cycles to kick in.

Now it is receiving notifications from all event producers as they come.

When it wishes to no longer receive notifications it needs to mark itself as invisible for reference cache fill-ins. In this way all reference cache flushes will not pick this implementation up even if it's still registered in the registry.

Eventually all active references will be removed by the natural producers flush cycles. The consumer may choose to expedite this by triggering a channel invalidation.

As with all service implementations, when all references to the services are released it can unload.

Typical lifetime of the event producers

An event producer will usually start at init time by creating channel(s).

Then, for each thread wishing to produce events, a reference cache must be created and maintained until the thread will no longer be producing events.

Now the thread can produce events using the reference cache. This is done by calling the get method and then iterating over the resulting set of references and calling each one in turn as one would normally do for registry service references. It is assumed that the references are owned by the cache and thus they should not be released.

With some cyclical (e.g. at the end of each statement or something) the event producing thread needs to flush the cache. This is to ensure that references to event consumers are not held for very long and that new event consumers are picked up. However flushing the cache is a relatively expensive operation and thus a balance between the number of events produced and the cache being flushed must be achieved.

General remarks

Channels are something each event producer must have to produce events. Channels are to be created by a single thread before the first event is ever produced. And, once created they are to be kept until after the last event is produced.

Channels serve as singletons for caches and you only need one channel instance per event producer component. There usually will be multiple caches (one per event producing thread) per channel.

Creating and destroying a channel is a relatively "expensive" operation that might involve some synchronization and should not be done frequently.

Channels exist to allow a non-related thread to trigger invalidation of all currently active caches on that channel. This is necessary when for example event consumers are registered and are about to be removed.

Invalidating a channel is a thread-safe operation that can be invoked without synchronization at any time.

Each channel is associated with a specific set of service names.

Note
It is a set of service names, not implementation names !

The names are stored and used in event caches to handle all implementations of that particular service.

◆ mysql_service_replication_applier_metrics_t

A service that allows you to extract stats from the replica applier.

You can extract general metrics for every running coordindator. You can extract metrics for all replication workers running

◆ mysql_service_thread_cleanup_handler_t

A service to cleanup thread resource.

◆ mysql_service_thread_cleanup_register_t

Thread cleanup service allows a OS thread to free resources allocated for specific thread, during thread exit.

Component can register for thread cleanup handler, for desired OS threads.

At thread exit, the service 'thread_cleanup_handler' implemented by the component is invoked by MySQL server.

thread cleanup.

The service can be instantiated using the registry service with the "thread_cleanup_register" name.

my_service<SERVICE_TYPE(thread_cleanup_register)>
svc("thread_cleanup_register", registry);
if (svc.is_valid()) {
// The service is ready to be used
}

The code below demonstrates way to register thread cleanup for a thread from a component. Note that we cannot deregister thread cleanup event. In case the component is uninstalled, then the thread cleanup is NO-OP.

svc->register_cleanup("implementation_name");

◆ mysql_service_validate_password_changed_characters_t

Service to enforce that new password contains N different characters compared to existing password.

REQUIRES_SERVICE(validate_password_changed_characters)
bool compare_passwords(const char *current_password,
unsigned int current_password_length,
const char * new_oassword,
unsigned int new_password_length) {
String current_password_string, new_password_string;
current_password_string.assign(current_password, current_password_length,
new_password_string.assign(new_password, new_password_length,
unsigned int min_required = 0, changed = 0;
if (mysql_service_validate_password_changed_characters->validate(
current_password_string, new_password_string,
&min_required, &changed)) {
// Raise error that min_required characters should be changed
return true;
}
return false;
}
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb3_bin
Definition: ctype-utf8.cc:5899

◆ mysql_service_validate_password_t

Interfaces to enforce a password policy.

The policy is enfoced through two methods 1) validate() that answers the question of whether this password is good enough or not.

2) get_strength() that can be used by password changing UIs to display a password strength meter in the range of [0-100] as the user enters a password.

bool validate_password(THD *thd, const char *password,
unsigned int password_length) {
String password_string;
password_string.set(password, password_length, &my_charset_utf8mb3_bin);
if (mysql_service_validate_password->validate(thd, password_string)) {
// Emit error that password does not adhere to policy criteria
return true;
}
return false;
}
unsigned int get_password_strength(THD *thd, const char *password,
unsigned int password_length) {
String password_string;
password_string.set(password, password_length, &my_charset_utf8mb3_bin);
unsigned int strength = 0;
if (mysql_service_validate_password->get_strength(thd, password_string,
&strength)) {
return 0;
}
return strength;
}
void set(String &str, size_t offset, size_t arg_length)
Definition: sql_string.h:302
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
static char * password
Definition: mysql_secure_installation.cc:58
static int get_password_strength(mysql_string_handle password)
Definition: validate_password.cc:402
static int validate_password(mysql_string_handle password)
Definition: validate_password.cc:397