MySQL 9.1.0
Source Code Documentation
client.cc File Reference
#include <openssl/opensslv.h>
#include <stdarg.h>
#include <sys/types.h>
#include "m_string.h"
#include "my_config.h"
#include "my_sys.h"
#include "mysql/strings/m_ctype.h"
#include "mysys_err.h"
#include <netdb.h>
#include <netinet/in.h>
#include <stdio.h>
#include <algorithm>
#include <fstream>
#include <ios>
#include <iostream>
#include <string>
#include "base64.h"
#include "client_async_authentication.h"
#include "compression.h"
#include "errmsg.h"
#include "lex_string.h"
#include "map_helpers.h"
#include "my_byteorder.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_default.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_openssl_fips.h"
#include "my_psi_config.h"
#include "my_shm_defaults.h"
#include "mysql.h"
#include "mysql/client_authentication.h"
#include "mysql/my_loglevel.h"
#include "mysql/plugin_auth_common.h"
#include "mysql/psi/mysql_memory.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql/strings/int2str.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include "strmake.h"
#include "strxmov.h"
#include "strxnmov.h"
#include "template_utils.h"
#include "typelib.h"
#include "violite.h"
#include "my_thread.h"
#include <signal.h>
#include <sys/stat.h>
#include <time.h>
#include <pwd.h>
#include <sys/select.h>
#include <sys/un.h>
#include <errno.h>
#include <mysql/client_plugin.h>
#include <openssl/x509v3.h>
#include <new>
#include "../libmysql/init_commands_array.h"
#include "../libmysql/mysql_trace.h"
#include "sql_common.h"
#include "mysql_com_server.h"
#include "sql/client_settings.h"
#include "sql/server_component/mysql_command_services_imp.h"
#include "client_extensions_macros.h"
#include "sql/log_event.h"
#include "sql/rpl_constants.h"
#include <stdlib.h>
#include <langinfo.h>
#include <locale.h>

Classes

struct  MY_CSET_OS_NAME
 
struct  My_hash
 

Macros

#define INVALID_SOCKET   -1
 
#define STATE_DATA(M)    (nullptr != (M) ? &(MYSQL_EXTENSION_PTR(M)->state_change) : nullptr)
 
#define ADD_INFO(M, element, type)
 
#define caching_sha2_password_plugin_name   "caching_sha2_password"
 
#define MYSQL_NATIVE_PASSWORD_PLUGIN_NAME   "mysql_native_password"
 
#define SSL_SESSION_is_resumable(x)   true
 
#define MAX_VARIABLE_STRING_LENGTH   9
 
#define MAX_CONNECTION_ATTR_STORAGE_LENGTH   65536
 
#define GTID_ENCODED_DATA_SIZE   8
 

Typedefs

typedef enum my_cs_match_type_enum my_cs_match_type
 

Enumerations

enum  option_id {
  OPT_port = 1 , OPT_socket , OPT_compress , OPT_password ,
  OPT_pipe , OPT_timeout , OPT_user , OPT_init_command ,
  OPT_host , OPT_database , OPT_debug , OPT_return_found_rows ,
  OPT_ssl_key , OPT_ssl_cert , OPT_ssl_ca , OPT_ssl_capath ,
  OPT_character_sets_dir , OPT_default_character_set , OPT_interactive_timeout , OPT_connect_timeout ,
  OPT_local_infile , OPT_disable_local_infile , OPT_ssl_cipher , OPT_max_allowed_packet ,
  OPT_protocol , OPT_shared_memory_base_name , OPT_multi_results , OPT_multi_statements ,
  OPT_multi_queries , OPT_report_data_truncation , OPT_plugin_dir , OPT_default_auth ,
  OPT_bind_address , OPT_ssl_crl , OPT_ssl_crlpath , OPT_enable_cleartext_plugin ,
  OPT_tls_version , OPT_ssl_mode , OPT_optional_resultset_metadata , OPT_ssl_fips_mode ,
  OPT_tls_ciphersuites , OPT_keep_this_one_last
}
 
enum  my_cs_match_type_enum { my_cs_exact , my_cs_approx , my_cs_unsupp }
 

Functions

void init_client_psi_keys (void)
 
static void mysql_prune_stmt_list (MYSQL *mysql)
 For use when the connection to the server has been lost (in which case the server has discarded all information about prepared statements associated with the connection). More...
 
static int read_com_query_metadata (MYSQL *mysql, uchar *pos, ulong field_count)
 Read resultset metadata returned by COM_QUERY command. More...
 
static int read_one_row (MYSQL *mysql, uint fields, MYSQL_ROW row, ulong *lengths)
 
static net_async_status read_one_row_nonblocking (MYSQL *mysql, uint fields, MYSQL_ROW row, ulong *lengths, int *res)
 
void free_async_qp_data (MYSQL_ASYNC *async_context)
 Free async_qp_data buffer in async_context. More...
 
void set_query_idle (MYSQL_ASYNC *async_context)
 Set async_context to idle status, free async_qp_data buffer. More...
 
static int get_vio_connect_timeout (MYSQL *mysql)
 Convert the connect timeout option to a timeout value for VIO functions (vio_socket_connect() and vio_io_wait()). More...
 
void set_mysql_error (MYSQL *mysql, int errcode, const char *sqlstate)
 Set the internal error message to mysql handler. More...
 
static bool my_net_is_inited (NET *net)
 Is this NET instance initialized? my_net_init() and net_end() More...
 
void net_clear_error (NET *net)
 Clear possible error state of struct NET. More...
 
void set_mysql_extended_error (MYSQL *mysql, int errcode, const char *sqlstate, const char *format,...)
 Set an error message on the client. More...
 
static void free_state_change_info (MYSQL_EXTENSION *ext)
 
bool buffer_check_remaining (MYSQL *mysql, uchar *packet, ulong packet_length, size_t bytes)
 Helper function to check if the buffer has at least bytes remaining. More...
 
my_ulonglong net_field_length_ll_safe (MYSQL *mysql, uchar **packet, ulong packet_length, bool *is_error)
 
void read_ok_ex (MYSQL *mysql, ulong length)
 Read Ok packet along with the server state change information. More...
 
static ulong cli_safe_read_with_ok_complete (MYSQL *mysql, bool parse_ok, bool *is_data_packet, ulong len)
 
net_async_status cli_safe_read_with_ok_nonblocking (MYSQL *mysql, bool parse_ok, bool *is_data_packet, ulong *res)
 Read a packet from server in asynchronous way. More...
 
net_async_status cli_safe_read_nonblocking (MYSQL *mysql, bool *is_data_packet, ulong *res)
 Its a non blocking version of cli_safe_read. More...
 
ulong cli_safe_read_with_ok (MYSQL *mysql, bool parse_ok, bool *is_data_packet)
 Read a packet from server. More...
 
ulong cli_safe_read (MYSQL *mysql, bool *is_data_packet)
 Read a packet from server. More...
 
void free_rows (MYSQL_DATA *cur)
 
bool cli_advanced_command (MYSQL *mysql, enum enum_server_command command, const uchar *header, size_t header_length, const uchar *arg, size_t arg_length, bool skip_check, MYSQL_STMT *stmt)
 
net_async_status cli_advanced_command_nonblocking (MYSQL *mysql, enum enum_server_command command, const uchar *header, ulong header_length, const uchar *arg, ulong arg_length, bool skip_check, MYSQL_STMT *stmt, bool *ret)
 
void free_old_query (MYSQL *mysql)
 
static net_async_status flush_one_result_nonblocking (MYSQL *mysql, bool *res)
 Finish reading of a partial result set from the server in asynchronous way. More...
 
static bool flush_one_result (MYSQL *mysql)
 Finish reading of a partial result set from the server. More...
 
static bool is_OK_packet (MYSQL *mysql, ulong length)
 
static bool is_auth_next_factor_packet (MYSQL *mysql)
 Helper method to check if received packet is AuthNextFactor packet. More...
 
static bool opt_flush_ok_packet (MYSQL *mysql, bool *is_ok_packet)
 Read a packet from network. More...
 
static net_async_status cli_flush_use_result_nonblocking (MYSQL *mysql, bool flush_all_results)
 
static void cli_flush_use_result (MYSQL *mysql, bool flush_all_results)
 
void end_server (MYSQL *mysql)
 
net_async_status STDCALL mysql_free_result_nonblocking (MYSQL_RES *result)
 Frees the memory allocated for a result, set by APIs which would have returned rows. More...
 
void STDCALL mysql_free_result (MYSQL_RES *result)
 
static int add_init_command (struct st_mysql_options *options, const char *cmd)
 
static char * set_ssl_option_unpack_path (const char *arg)
 
void mysql_read_default_options (struct st_mysql_options *options, const char *filename, const char *group)
 
static void cli_fetch_lengths (ulong *to, MYSQL_ROW column, unsigned int field_count)
 
static int unpack_field (MYSQL *mysql, MEM_ROOT *alloc, bool default_value, uint server_capabilities, MYSQL_ROWS *row, MYSQL_FIELD *field)
 Read field metadata from field descriptor and store it in MYSQL_FIELD structure. More...
 
MYSQL_FIELDunpack_fields (MYSQL *mysql, MYSQL_ROWS *data, MEM_ROOT *alloc, uint fields, bool default_value, uint server_capabilities)
 
net_async_status cli_read_metadata_ex_nonblocking (MYSQL *mysql, MEM_ROOT *alloc, ulong field_count, unsigned int field, MYSQL_FIELD **ret)
 Read metadata resultset from server in asynchronous way. More...
 
MYSQL_FIELDcli_read_metadata_ex (MYSQL *mysql, MEM_ROOT *alloc, ulong field_count, unsigned int field)
 Read metadata resultset from server Memory allocated in a given allocator root. More...
 
static int alloc_field_alloc (MYSQL *mysql)
 
MYSQL_FIELDcli_read_metadata (MYSQL *mysql, ulong field_count, unsigned int field)
 Read metadata resultset from server. More...
 
static net_async_status cli_read_metadata_nonblocking (MYSQL *mysql, ulong field_count, unsigned int field, MYSQL_FIELD **ret)
 Helper method to read metadata in asynchronous way. More...
 
static net_async_status read_com_query_metadata_nonblocking (MYSQL *mysql, uchar *pos, ulong field_count, int *res)
 Read resultset metadata returned by COM_QUERY command in asynchronous way. More...
 
net_async_status cli_read_rows_nonblocking (MYSQL *mysql, MYSQL_FIELD *mysql_fields, unsigned int fields, MYSQL_DATA **result_out)
 
MYSQL_DATAcli_read_rows (MYSQL *mysql, MYSQL_FIELD *mysql_fields, unsigned int fields)
 
static int read_one_row_complete (MYSQL *mysql, ulong pkt_len, bool is_data_packet, uint fields, MYSQL_ROW row, ulong *lengths)
 
static bool cli_read_query_result (MYSQL *mysql)
 
static net_async_status cli_read_query_result_nonblocking (MYSQL *mysql)
 
static MYSQL_REScli_use_result (MYSQL *mysql)
 
static MYSQL_ROW cli_fetch_row (MYSQL_RES *mysql_res)
 
static MYSQLcli_connect (mysql_async_connect *ctx)
 
int cli_read_change_user_result (MYSQL *mysql)
 
net_async_status cli_read_change_user_result_nonblocking (MYSQL *mysql, ulong *ret)
 
MYSQL *STDCALL mysql_init (MYSQL *mysql)
 
MYSQL_EXTENSIONmysql_extension_init (MYSQL *mysql)
 
void mysql_extension_bind_free (MYSQL_EXTENSION *ext)
 
void mysql_extension_free (MYSQL_EXTENSION *ext)
 
bool STDCALL mysql_ssl_set (MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher)
 
static void mysql_ssl_free (MYSQL *mysql)
 
const char *STDCALL mysql_get_ssl_cipher (MYSQL *mysql)
 
void *STDCALL mysql_get_ssl_session_data (MYSQL *mysql, unsigned int n_ticket, unsigned int *out_len)
 Get the current SSL session serialization. More...
 
static SSL_SESSION * ssl_session_deserialize_from_data_ptr (MYSQL *, char *data)
 
bool STDCALL mysql_free_ssl_session_data (MYSQL *mysql, void *data)
 Free a saved SSL session serialization. More...
 
bool STDCALL mysql_get_ssl_session_reused (MYSQL *mysql)
 Check if the current ssl session is reused. More...
 
static int ssl_verify_server_cert (Vio *vio, const char *server_hostname, const char **errptr)
 
const char * my_os_charset_to_mysql_charset (const char *csname)
 
static int mysql_autodetect_character_set (MYSQL *mysql)
 
static void mysql_set_character_set_with_default_collation (MYSQL *mysql)
 
int mysql_init_character_set (MYSQL *mysql)
 
static int client_mpvio_write_packet (MYSQL_PLUGIN_VIO *mpv, const uchar *pkt, int pkt_len)
 vio->write_packet() callback method for client authentication plugins More...
 
static net_async_status client_mpvio_write_packet_nonblocking (struct MYSQL_PLUGIN_VIO *mpv, const uchar *pkt, int pkt_len, int *result)
 vio->write_packet() nonblocking callback method for client authentication plugins More...
 
static int clear_password_auth_client (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
 The main function of the mysql_clear_password authentication plugin. More...
 
static ucharwrite_length_encoded_string3 (uchar *buf, const char *string, size_t length)
 
ucharsend_client_connect_attrs (MYSQL *mysql, uchar *buf)
 
static size_t get_length_store_length (size_t length)
 
static char * write_length_encoded_string4 (char *dest, char *dest_end, const uchar *src, const uchar *src_end)
 
static char * write_string (char *dest, char *dest_end, const uchar *src, const uchar *src_end)
 
static int send_change_user_packet (MCPVIO_EXT *mpvio, const uchar *data, int data_len)
 Sends a COM_CHANGE_USER with a caller provided payload. More...
 
static char * mysql_fill_packet_header (MYSQL *mysql, char *buff, size_t buff_size)
 Fill in the beginning of the client reply packet. More...
 
static void cli_calculate_client_flag (MYSQL *mysql, const char *db, ulong client_flag)
 Calculates client capabilities in effect (mysql->client_flag) More...
 
static SSL_SESSION * ssl_session_deserialize_from_data (MYSQL *mysql)
 
static int cli_establish_ssl (MYSQL *mysql)
 Establishes SSL if requested and supported. More...
 
static net_async_status cli_establish_ssl_nonblocking (MYSQL *mysql, int *res)
 This function will establish asynchronous ssl connection by completing 4 different ssl connection states. More...
 
static mysql_state_machine_status authsm_begin_plugin_auth (mysql_async_auth *ctx)
 Asynchronous authentication phase is divided into several smaller chunks of subtasks like: More...
 
static mysql_state_machine_status authsm_run_first_authenticate_user (mysql_async_auth *ctx)
 Authentication can have two authenticate_user calls, depending on what the server responds with; this handles the first. More...
 
static mysql_state_machine_status authsm_handle_first_authenticate_user (mysql_async_auth *ctx)
 Handle the result of the first authenticate_user. More...
 
static mysql_state_machine_status authsm_read_change_user_result (mysql_async_auth *ctx)
 After the first authenticate_user comes a call to read the result of the implied change_user. More...
 
static mysql_state_machine_status authsm_handle_change_user_result (mysql_async_auth *ctx)
 Check if server asked to use a different authentication plugin. More...
 
static mysql_state_machine_status authsm_run_second_authenticate_user (mysql_async_auth *ctx)
 Start the authentication process again with the plugin which server asked for. More...
 
static mysql_state_machine_status authsm_handle_second_authenticate_user (mysql_async_auth *ctx)
 
static mysql_state_machine_status authsm_finish_auth (mysql_async_auth *ctx)
 
static mysql_state_machine_status authsm_init_multi_auth (mysql_async_auth *ctx)
 Start multi factor authentication. More...
 
static mysql_state_machine_status authsm_do_multi_plugin_auth (mysql_async_auth *ctx)
 Invoke client plugins authentication method. More...
 
static mysql_state_machine_status authsm_handle_multi_auth_response (mysql_async_auth *ctx)
 Handle response from client plugins authentication method. More...
 
static mysql_state_machine_status csm_begin_connect (mysql_async_connect *ctx)
 Asynchronous connection phase is divided into several smaller modules where wach module does following: More...
 
static mysql_state_machine_status csm_complete_connect (mysql_async_connect *ctx)
 Complete the connection itself, setting options on the now-connected socket. More...
 
static mysql_state_machine_status csm_wait_connect (mysql_async_connect *ctx)
 Wait for async connect attempt to complete. More...
 
static mysql_state_machine_status csm_read_greeting (mysql_async_connect *ctx)
 Read the greeting from the server that is read the first packet. More...
 
static mysql_state_machine_status csm_parse_handshake (mysql_async_connect *ctx)
 Parse the handshake from the server. More...
 
static mysql_state_machine_status csm_establish_ssl (mysql_async_connect *ctx)
 Establish SSL if needed. More...
 
static mysql_state_machine_status csm_authenticate (mysql_async_connect *ctx)
 Invoke the authentication client plugin API to send the authentication data to the server. More...
 
static mysql_state_machine_status csm_prep_select_database (mysql_async_connect *ctx)
 Authenticated, set initial database if specified. More...
 
int mysql_get_socket_descriptor (MYSQL *mysql)
 
connect_stage STDCALL mysql_get_connect_nonblocking_stage (MYSQL *mysql)
 
static bool prep_client_reply_packet (MCPVIO_EXT *mpvio, const uchar *data, int data_len, char **buff_out, int *buff_len)
 sends a client authentication packet (second packet in the 3-way handshake) More...
 
static int send_client_reply_packet (MCPVIO_EXT *mpvio, const uchar *data, int data_len)
 
static net_async_status send_client_reply_packet_nonblocking (MCPVIO_EXT *mpvio, const uchar *pkt, int pkt_len, bool *result)
 
static int client_mpvio_read_packet (MYSQL_PLUGIN_VIO *mpv, uchar **buf)
 vio->read_packet() callback method for client authentication plugins More...
 
static net_async_status client_mpvio_read_packet_nonblocking (struct MYSQL_PLUGIN_VIO *mpv, uchar **buf, int *result)
 vio->read_packet() nonblocking callback method for client authentication plugins More...
 
void mpvio_info (Vio *vio, MYSQL_PLUGIN_VIO_INFO *info)
 fills MYSQL_PLUGIN_VIO_INFO structure with the information about the connection More...
 
static void client_mpvio_info (MYSQL_PLUGIN_VIO *vio, MYSQL_PLUGIN_VIO_INFO *info)
 
static bool check_plugin_enabled (MYSQL *mysql, mysql_async_auth *ctx)
 
static void reset_async_auth_data (mysql_async_auth &ctx)
 
int run_plugin_auth (MYSQL *mysql, char *data, uint data_len, const char *data_plugin, const char *db)
 Client side of the plugin driver authentication. More...
 
mysql_state_machine_status run_plugin_auth_nonblocking (MYSQL *mysql, char *data, uint data_len, const char *data_plugin, const char *db)
 This functions drives the authentication on client side in a nonblocking way. More...
 
static int set_connect_attributes (MYSQL *mysql, char *buff, size_t buf_len)
 set some default attributes More...
 
MYSQLconnect_helper (mysql_async_connect *ctx)
 
MYSQL *STDCALL mysql_real_connect (MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket, ulong client_flag)
 
net_async_status STDCALL mysql_real_connect_nonblocking (MYSQL *mysql, const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket, ulong client_flag)
 This API attempts to initialize all the context needed to make an asynchronous connection followed by establishing a connection to MySQL database. More...
 
bool mysql_reconnect (MYSQL *mysql)
 
int STDCALL mysql_binlog_open (MYSQL *mysql, MYSQL_RPL *rpl)
 Open a new replication stream. More...
 
int STDCALL mysql_binlog_fetch (MYSQL *mysql, MYSQL_RPL *rpl)
 Fetch one event from the server. More...
 
void STDCALL mysql_binlog_close (MYSQL *mysql, MYSQL_RPL *rpl)
 Close replication stream. More...
 
int STDCALL mysql_select_db (MYSQL *mysql, const char *db)
 
void mysql_close_free_options (MYSQL *mysql)
 
void mysql_close_free (MYSQL *mysql)
 
void mysql_detach_stmt_list (LIST **stmt_list, const char *func_name)
 
void STDCALL mysql_close (MYSQL *mysql)
 
static int mysql_prepare_com_query_parameters (MYSQL *mysql, unsigned char **pret_data, unsigned long *pret_data_length)
 Helper function to serialize the parameters data. More...
 
int STDCALL mysql_send_query (MYSQL *mysql, const char *query, ulong length)
 
static net_async_status mysql_send_query_nonblocking_inner (MYSQL *mysql, const char *query, ulong length)
 Executes the SQL statement pointed by query. More...
 
net_async_status STDCALL mysql_send_query_nonblocking (MYSQL *mysql, const char *query, ulong length)
 Wrapper around mysql_send_query_nonblocking_inner to be called externally. More...
 
int STDCALL mysql_real_query (MYSQL *mysql, const char *query, ulong length)
 
net_async_status STDCALL mysql_real_query_nonblocking (MYSQL *mysql, const char *query, ulong length)
 Executes the SQL statement pointed by query. More...
 
MYSQL_RES *STDCALL mysql_store_result (MYSQL *mysql)
 
enum net_async_status STDCALL mysql_store_result_nonblocking (MYSQL *mysql, MYSQL_RES **result)
 This API reads all result set sent by server in an asynchronous way. More...
 
MYSQL_RESuse_result (MYSQL *mysql)
 
MYSQL_ROW STDCALL mysql_fetch_row (MYSQL_RES *res)
 
net_async_status STDCALL mysql_fetch_row_nonblocking (MYSQL_RES *res, MYSQL_ROW *row)
 Reads next row of a result set in an asynchronous way. More...
 
ulong *STDCALL mysql_fetch_lengths (MYSQL_RES *res)
 
static bool set_load_data_local_infile_option (MYSQL *mysql, const char *arg)
 Validates, makes into an absolute path and sets MYSQL_OPT_LOAD_DATA_LOCAL_DIR value. More...
 
int STDCALL mysql_options (MYSQL *mysql, enum mysql_option option, const void *arg)
 
int STDCALL mysql_get_option (MYSQL *mysql, enum mysql_option option, const void *arg)
 Return the current values for the options settable through mysql_options() More...
 
int STDCALL mysql_options4 (MYSQL *mysql, enum mysql_option option, const void *arg1, const void *arg2)
 
my_ulonglong STDCALL mysql_num_rows (MYSQL_RES *res)
 
unsigned int STDCALL mysql_num_fields (MYSQL_RES *res)
 
uint STDCALL mysql_errno (MYSQL *mysql)
 
const char *STDCALL mysql_error (MYSQL *mysql)
 
static int get_data_and_length (LIST *node, const char **data, size_t *length)
 Read data and its length from a LIST node. More...
 
int STDCALL mysql_session_track_get_first (MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length)
 Get the first state change information received from the server. More...
 
int STDCALL mysql_session_track_get_next (MYSQL *mysql, enum enum_session_state_type type, const char **data, size_t *length)
 Get the subsequent state change information received from the server. More...
 
ulong STDCALL mysql_get_server_version (MYSQL *mysql)
 
int STDCALL mysql_set_character_set (MYSQL *mysql, const char *cs_name)
 
const char *STDCALL mysql_info (MYSQL *mysql)
 
static void reset_connection (MYSQL *mysql)
 
int STDCALL mysql_reset_connection (MYSQL *mysql)
 
net_async_status STDCALL mysql_reset_connection_nonblocking (MYSQL *mysql)
 
bool STDCALL mysql_commit (MYSQL *mysql)
 
bool STDCALL mysql_rollback (MYSQL *mysql)
 
bool STDCALL mysql_autocommit (MYSQL *mysql, bool auto_mode)
 
bool STDCALL mysql_more_results (MYSQL *mysql)
 
int STDCALL mysql_next_result (MYSQL *mysql)
 
MYSQL_RES *STDCALL mysql_use_result (MYSQL *mysql)
 
uint64_t STDCALL mysql_affected_rows (MYSQL *mysql)
 
enum_resultset_metadata STDCALL mysql_result_metadata (MYSQL_RES *result)
 
MYSQL_FIELD *STDCALL mysql_fetch_field (MYSQL_RES *result)
 
MYSQL_FIELD *STDCALL mysql_fetch_fields (MYSQL_RES *res)
 
unsigned int STDCALL mysql_field_count (MYSQL *mysql)
 
const char *STDCALL mysql_sqlstate (MYSQL *mysql)
 
const char * fieldtype2str (enum enum_field_types type)
 Returns a string for a mysql field type. More...
 

Variables

PSI_memory_key key_memory_mysql_options
 
PSI_memory_key key_memory_MYSQL_DATA
 
PSI_memory_key key_memory_MYSQL
 
PSI_memory_key key_memory_MYSQL_RES
 
PSI_memory_key key_memory_MYSQL_ROW
 
PSI_memory_key key_memory_MYSQL_state_change_info
 
PSI_memory_key key_memory_MYSQL_HANDSHAKE
 
PSI_memory_key key_memory_MYSQL_ssl_session_data
 
static PSI_memory_info all_client_memory []
 
uint mysql_port = 0
 
char * mysql_unix_port = nullptr
 
const char * unknown_sqlstate = "HY000"
 
const char * not_error_sqlstate = "00000"
 
const char * cant_connect_sqlstate = "08001"
 
ulong g_net_buffer_length = 8192
 
ulong g_max_allowed_packet = 1024L * 1024L * 1024L
 
CHARSET_INFOdefault_client_charset_info = &my_charset_latin1
 
unsigned int mysql_server_last_errno
 
char mysql_server_last_error [MYSQL_ERRMSG_SIZE]
 
static const char * default_options []
 
static TYPELIB option_types
 
const char * sql_protocol_names_lib []
 
TYPELIB sql_protocol_typelib
 
static MYSQL_METHODS client_methods
 
const MY_CSET_OS_NAME charsets []
 
static auth_plugin_t clear_password_client_plugin
 
static auth_plugin_t sha256_password_client_plugin
 
static auth_plugin_t caching_sha2_password_client_plugin
 
struct st_mysql_client_pluginmysql_client_builtins []
 
bool libmysql_cleartext_plugin_enabled = false
 

Macro Definition Documentation

◆ ADD_INFO

#define ADD_INFO (   M,
  element,
  type 
)
Value:
{ \
M = STATE_DATA(mysql); \
M->info_list[type].head_node = \
list_add(M->info_list[type].head_node, element); \
}
#define M
Definition: ctype-tis620.cc:73
Definition: instrumented_condition_variable.h:32
required string type
Definition: replication_group_member_actions.proto:34
#define STATE_DATA(M)
Definition: client.cc:153

◆ caching_sha2_password_plugin_name

#define caching_sha2_password_plugin_name   "caching_sha2_password"

◆ GTID_ENCODED_DATA_SIZE

#define GTID_ENCODED_DATA_SIZE   8

◆ INVALID_SOCKET

#define INVALID_SOCKET   -1

◆ MAX_CONNECTION_ATTR_STORAGE_LENGTH

#define MAX_CONNECTION_ATTR_STORAGE_LENGTH   65536

◆ MAX_VARIABLE_STRING_LENGTH

#define MAX_VARIABLE_STRING_LENGTH   9

◆ MYSQL_NATIVE_PASSWORD_PLUGIN_NAME

#define MYSQL_NATIVE_PASSWORD_PLUGIN_NAME   "mysql_native_password"

◆ SSL_SESSION_is_resumable

#define SSL_SESSION_is_resumable (   x)    true

◆ STATE_DATA

#define STATE_DATA (   M)     (nullptr != (M) ? &(MYSQL_EXTENSION_PTR(M)->state_change) : nullptr)

Typedef Documentation

◆ my_cs_match_type

Enumeration Type Documentation

◆ my_cs_match_type_enum

Enumerator
my_cs_exact 
my_cs_approx 
my_cs_unsupp 

◆ option_id

enum option_id
Enumerator
OPT_port 
OPT_socket 
OPT_compress 
OPT_password 
OPT_pipe 
OPT_timeout 
OPT_user 
OPT_init_command 
OPT_host 
OPT_database 
OPT_debug 
OPT_return_found_rows 
OPT_ssl_key 
OPT_ssl_cert 
OPT_ssl_ca 
OPT_ssl_capath 
OPT_character_sets_dir 
OPT_default_character_set 
OPT_interactive_timeout 
OPT_connect_timeout 
OPT_local_infile 
OPT_disable_local_infile 
OPT_ssl_cipher 
OPT_max_allowed_packet 
OPT_protocol 
OPT_shared_memory_base_name 
OPT_multi_results 
OPT_multi_statements 
OPT_multi_queries 
OPT_report_data_truncation 
OPT_plugin_dir 
OPT_default_auth 
OPT_bind_address 
OPT_ssl_crl 
OPT_ssl_crlpath 
OPT_enable_cleartext_plugin 
OPT_tls_version 
OPT_ssl_mode 
OPT_optional_resultset_metadata 
OPT_ssl_fips_mode 
OPT_tls_ciphersuites 
OPT_keep_this_one_last 

Function Documentation

◆ add_init_command()

static int add_init_command ( struct st_mysql_options options,
const char *  cmd 
)
static

◆ alloc_field_alloc()

static int alloc_field_alloc ( MYSQL mysql)
static

◆ authsm_begin_plugin_auth()

static mysql_state_machine_status authsm_begin_plugin_auth ( mysql_async_auth ctx)
static

Asynchronous authentication phase is divided into several smaller chunks of subtasks like:

Determine the default/initial plugin to use.

  1. Determine the default/initial plugin to use
  2. Call authentication plugin API
  3. Handle response from authentication plugin API
  4. Check if server asked to use a different authentication plugin
  5. In case server asked to use a different authentication plugin use that plugin to start the authentication process again.
  6. Complete authentication.

All above tasks are implemented in below authsm_* functions where authsm stads for authentication state machine.

◆ authsm_do_multi_plugin_auth()

static mysql_state_machine_status authsm_do_multi_plugin_auth ( mysql_async_auth ctx)
static

Invoke client plugins authentication method.

◆ authsm_finish_auth()

static mysql_state_machine_status authsm_finish_auth ( mysql_async_auth ctx)
static

◆ authsm_handle_change_user_result()

static mysql_state_machine_status authsm_handle_change_user_result ( mysql_async_auth ctx)
static

Check if server asked to use a different authentication plugin.

◆ authsm_handle_first_authenticate_user()

static mysql_state_machine_status authsm_handle_first_authenticate_user ( mysql_async_auth ctx)
static

Handle the result of the first authenticate_user.

◆ authsm_handle_multi_auth_response()

static mysql_state_machine_status authsm_handle_multi_auth_response ( mysql_async_auth ctx)
static

Handle response from client plugins authentication method.

◆ authsm_handle_second_authenticate_user()

static mysql_state_machine_status authsm_handle_second_authenticate_user ( mysql_async_auth ctx)
static

◆ authsm_init_multi_auth()

static mysql_state_machine_status authsm_init_multi_auth ( mysql_async_auth ctx)
static

Start multi factor authentication.

◆ authsm_read_change_user_result()

static mysql_state_machine_status authsm_read_change_user_result ( mysql_async_auth ctx)
static

After the first authenticate_user comes a call to read the result of the implied change_user.

◆ authsm_run_first_authenticate_user()

static mysql_state_machine_status authsm_run_first_authenticate_user ( mysql_async_auth ctx)
static

Authentication can have two authenticate_user calls, depending on what the server responds with; this handles the first.

◆ authsm_run_second_authenticate_user()

static mysql_state_machine_status authsm_run_second_authenticate_user ( mysql_async_auth ctx)
static

Start the authentication process again with the plugin which server asked for.

◆ buffer_check_remaining()

bool buffer_check_remaining ( MYSQL mysql,
uchar packet,
ulong  packet_length,
size_t  bytes 
)
inline

Helper function to check if the buffer has at least bytes remaining.

If the buffer is too small it raises CR_MALFORMED_PACKET_ERROR.

Parameters
mysqlthe handle that has the buffer
packetthe current position in the buffer
packet_lengththe size of the packet
bytesthe bytes that we want available
Return values
truethe buffer has that many bytes
falsethe buffer has less bytes remaining

◆ check_plugin_enabled()

static bool check_plugin_enabled ( MYSQL mysql,
mysql_async_auth ctx 
)
static

◆ clear_password_auth_client()

static int clear_password_auth_client ( MYSQL_PLUGIN_VIO vio,
MYSQL mysql 
)
static

The main function of the mysql_clear_password authentication plugin.

◆ cli_advanced_command()

bool cli_advanced_command ( MYSQL mysql,
enum enum_server_command  command,
const uchar header,
size_t  header_length,
const uchar arg,
size_t  arg_length,
bool  skip_check,
MYSQL_STMT stmt 
)

◆ cli_advanced_command_nonblocking()

net_async_status cli_advanced_command_nonblocking ( MYSQL mysql,
enum enum_server_command  command,
const uchar header,
ulong  header_length,
const uchar arg,
ulong  arg_length,
bool  skip_check,
MYSQL_STMT stmt,
bool *  ret 
)

When non blocking API execution is pending and did not complete then it can result in async context to be null. In such case if user executes any other API report command out of sync error.

◆ cli_calculate_client_flag()

static void cli_calculate_client_flag ( MYSQL mysql,
const char *  db,
ulong  client_flag 
)
static

Calculates client capabilities in effect (mysql->client_flag)

Needs to be called immediately after receiving the server handshake packet.

Parameters
mysqlthe connection context
dbThe database specified by the client app
client_flagThe client flag as specified by the client app

◆ cli_connect()

MYSQL * cli_connect ( mysql_async_connect ctx)
static

◆ cli_establish_ssl()

static int cli_establish_ssl ( MYSQL mysql)
static

Establishes SSL if requested and supported.

Parameters
mysqlthe connection handle
Return values
0success
1failure

◆ cli_establish_ssl_nonblocking()

static net_async_status cli_establish_ssl_nonblocking ( MYSQL mysql,
int *  res 
)
static

This function will establish asynchronous ssl connection by completing 4 different ssl connection states.

Initial state is set to SSL_NONE during which this functions does priliminary checks like if server supports ssl or not, if CA certificate is required etc. Once preliminary checks are done state is changed to SSL_REQUEST. In this state ssl request packet is sent by client. If this network IO is complete, state is changed to SSL_CONNECT. During SSL_CONNECT sslconnect() is called which can return immediately or complete SSL handshake. If it returns immediately client will save all SSL context in struct mysql_async_auth, so that next call to this function will ensure that SSL_new() is not called twice. Once ssl connection is established state is changed to SSL_COMPLETE.

Parameters
[in]mysqlClient connection handle.
[out]resset to false in case of success and true for error.
Return values
NET_ASYNC_NOT_READYssl connection not yet established
NET_ASYNC_COMPLETEssl connection established

◆ cli_fetch_lengths()

static void cli_fetch_lengths ( ulong *  to,
MYSQL_ROW  column,
unsigned int  field_count 
)
static

◆ cli_fetch_row()

MYSQL_ROW cli_fetch_row ( MYSQL_RES mysql_res)
static

◆ cli_flush_use_result()

static void cli_flush_use_result ( MYSQL mysql,
bool  flush_all_results 
)
static

◆ cli_flush_use_result_nonblocking()

static net_async_status cli_flush_use_result_nonblocking ( MYSQL mysql,
bool  flush_all_results 
)
static

◆ cli_read_change_user_result()

int cli_read_change_user_result ( MYSQL mysql)

◆ cli_read_change_user_result_nonblocking()

net_async_status cli_read_change_user_result_nonblocking ( MYSQL mysql,
ulong *  ret 
)

◆ cli_read_metadata()

MYSQL_FIELD * cli_read_metadata ( MYSQL mysql,
ulong  field_count,
unsigned int  field 
)

Read metadata resultset from server.

Parameters
[in]mysqlconnection handle
[in]field_counttotal number of fields
[in]fieldnumber of columns in single field descriptor
Return values
anarray of field rows

◆ cli_read_metadata_ex()

MYSQL_FIELD * cli_read_metadata_ex ( MYSQL mysql,
MEM_ROOT alloc,
ulong  field_count,
unsigned int  field 
)

Read metadata resultset from server Memory allocated in a given allocator root.

Parameters
[in]mysqlconnection handle
[in]allocmemory allocator root
[in]field_counttotal number of fields
[in]fieldnumber of columns in single field descriptor
Return values
anarray of field rows

◆ cli_read_metadata_ex_nonblocking()

net_async_status cli_read_metadata_ex_nonblocking ( MYSQL mysql,
MEM_ROOT alloc,
ulong  field_count,
unsigned int  field,
MYSQL_FIELD **  ret 
)

Read metadata resultset from server in asynchronous way.

Parameters
[in]mysqlconnection handle
[in]allocmemory allocator root
[in]field_counttotal number of fields
[in]fieldnumber of columns in single field descriptor
[out]retan array of field rows
Return values
NET_ASYNC_NOT_READYmetadata resultset not read completely
NET_ASYNC_COMPLETEfinished reading metadata resultset

◆ cli_read_metadata_nonblocking()

static net_async_status cli_read_metadata_nonblocking ( MYSQL mysql,
ulong  field_count,
unsigned int  field,
MYSQL_FIELD **  ret 
)
static

Helper method to read metadata in asynchronous way.

◆ cli_read_query_result()

static bool cli_read_query_result ( MYSQL mysql)
static

◆ cli_read_query_result_nonblocking()

static net_async_status cli_read_query_result_nonblocking ( MYSQL mysql)
static

◆ cli_read_rows()

MYSQL_DATA * cli_read_rows ( MYSQL mysql,
MYSQL_FIELD mysql_fields,
unsigned int  fields 
)

◆ cli_read_rows_nonblocking()

net_async_status cli_read_rows_nonblocking ( MYSQL mysql,
MYSQL_FIELD mysql_fields,
unsigned int  fields,
MYSQL_DATA **  result_out 
)

◆ cli_safe_read()

ulong cli_safe_read ( MYSQL mysql,
bool *  is_data_packet 
)

Read a packet from server.

Give error message if connection was broken or ERR packet was received. Detect if the packet received was an OK, ERR or something else (a "data packet").

Parameters
[in]mysqlconnection handle
[out]is_data_packetif set to true then the packet received was a "data packet".
Return values
Thelength of the packet that was read or packet_error in case of error. In case of error its description is stored in mysql handle.

◆ cli_safe_read_nonblocking()

net_async_status cli_safe_read_nonblocking ( MYSQL mysql,
bool *  is_data_packet,
ulong *  res 
)

Its a non blocking version of cli_safe_read.

◆ cli_safe_read_with_ok()

ulong cli_safe_read_with_ok ( MYSQL mysql,
bool  parse_ok,
bool *  is_data_packet 
)

Read a packet from server.

Give error message if socket was down or packet is an error message

Parameters
[in]mysqlconnection handle
[in]parse_okif set to true then parse OK packet if it is received
[out]is_data_packetif set to true then packet received is a "data packet", that is not OK or ERR packet or EOF in case of old servers
Returns
The length of the packet that was read or packet_error in case of error. In case of error its description is stored in mysql handle.

◆ cli_safe_read_with_ok_complete()

ulong cli_safe_read_with_ok_complete ( MYSQL mysql,
bool  parse_ok,
bool *  is_data_packet,
ulong  len 
)
static

◆ cli_safe_read_with_ok_nonblocking()

net_async_status cli_safe_read_with_ok_nonblocking ( MYSQL mysql,
bool  parse_ok,
bool *  is_data_packet,
ulong *  res 
)

Read a packet from server in asynchronous way.

This function can return without completely reading the packet, in such a case call this function again until complete packet is read.

Parameters
[in]mysqlconnection handle
[in]parse_okif set to true then parse OK packet if it was sent by server
[out]is_data_packetif set to true then the packet received was a "data packet".
[out]resThe length of the packet that was read or packet_error in case of error.
Return values
NET_ASYNC_NOT_READYpacket was not completely read
NET_ASYNC_COMPLETEfinished reading packet

◆ cli_use_result()

static MYSQL_RES * cli_use_result ( MYSQL mysql)
static

◆ client_mpvio_info()

static void client_mpvio_info ( MYSQL_PLUGIN_VIO vio,
MYSQL_PLUGIN_VIO_INFO info 
)
static

◆ client_mpvio_read_packet()

static int client_mpvio_read_packet ( MYSQL_PLUGIN_VIO mpv,
uchar **  buf 
)
static

vio->read_packet() callback method for client authentication plugins

This function is called by a client authentication plugin, when it wants to read data from the server.

◆ client_mpvio_read_packet_nonblocking()

static net_async_status client_mpvio_read_packet_nonblocking ( struct MYSQL_PLUGIN_VIO mpv,
uchar **  buf,
int *  result 
)
static

vio->read_packet() nonblocking callback method for client authentication plugins

◆ client_mpvio_write_packet()

static int client_mpvio_write_packet ( MYSQL_PLUGIN_VIO mpv,
const uchar pkt,
int  pkt_len 
)
static

vio->write_packet() callback method for client authentication plugins

This function is called by a client authentication plugin, when it wants to send data to the server.

It transparently wraps the data into a change user or authentication handshake packet, if necessary.

◆ client_mpvio_write_packet_nonblocking()

static net_async_status client_mpvio_write_packet_nonblocking ( struct MYSQL_PLUGIN_VIO mpv,
const uchar pkt,
int  pkt_len,
int *  result 
)
static

vio->write_packet() nonblocking callback method for client authentication plugins

◆ connect_helper()

MYSQL * connect_helper ( mysql_async_connect ctx)

◆ csm_authenticate()

static mysql_state_machine_status csm_authenticate ( mysql_async_connect ctx)
static

Invoke the authentication client plugin API to send the authentication data to the server.

◆ csm_begin_connect()

static mysql_state_machine_status csm_begin_connect ( mysql_async_connect ctx)
static

Asynchronous connection phase is divided into several smaller modules where wach module does following:

Begin the connection to the server, including any DNS resolution necessary, socket configuration, etc.

  1. Begin the connection to the server, including any DNS resolution necessary, socket configuration, etc
  2. Complete the connection itself
  3. Connection established, read the first packet
  4. Parse the handshake from the server
  5. Establish SSL connection if needed
  6. Invoke the plugin to send the authentication data to the server
  7. Authenticated, set initial database if specified
  8. Send COM_INIT_DB.
  9. Prepare to send a sequence of init commands. 10.Send an init command.

Below are the modules which does all above tasks.

◆ csm_complete_connect()

static mysql_state_machine_status csm_complete_connect ( mysql_async_connect ctx)
static

Complete the connection itself, setting options on the now-connected socket.

◆ csm_establish_ssl()

static mysql_state_machine_status csm_establish_ssl ( mysql_async_connect ctx)
static

Establish SSL if needed.

◆ csm_parse_handshake()

static mysql_state_machine_status csm_parse_handshake ( mysql_async_connect ctx)
static

Parse the handshake from the server.

old server with no CLIENT_PLUGIN_AUTH support, so assume native auth

◆ csm_prep_select_database()

static mysql_state_machine_status csm_prep_select_database ( mysql_async_connect ctx)
static

Authenticated, set initial database if specified.

◆ csm_read_greeting()

static mysql_state_machine_status csm_read_greeting ( mysql_async_connect ctx)
static

Read the greeting from the server that is read the first packet.

◆ csm_wait_connect()

static mysql_state_machine_status csm_wait_connect ( mysql_async_connect ctx)
static

Wait for async connect attempt to complete.

◆ end_server()

void end_server ( MYSQL mysql)

◆ fieldtype2str()

const char * fieldtype2str ( enum enum_field_types  type)

Returns a string for a mysql field type.

Parameters
typethe type of the field.

◆ flush_one_result()

static bool flush_one_result ( MYSQL mysql)
static

Finish reading of a partial result set from the server.

Get the EOF packet, and update mysql->status and mysql->warning_count.

Returns
true if a communication or protocol error, an error is set in this case, false otherwise.

◆ flush_one_result_nonblocking()

static net_async_status flush_one_result_nonblocking ( MYSQL mysql,
bool *  res 
)
static

Finish reading of a partial result set from the server in asynchronous way.

This function can return without completely flushing the result set, in such a case call this function again until result set in flushed. Read OK packet in case result set is not a data packet.

Parameters
[in]mysqlconnection handle
[out]restrue in case of protocol error, false otherwise
Return values
NET_ASYNC_NOT_READYresult set not flushed yet
NET_ASYNC_COMPLETEfinished flushing result set

◆ free_async_qp_data()

void free_async_qp_data ( MYSQL_ASYNC async_context)
inline

Free async_qp_data buffer in async_context.

Parameters
async_contextpointer to asynchronous context structure

◆ free_old_query()

void free_old_query ( MYSQL mysql)

◆ free_rows()

void free_rows ( MYSQL_DATA cur)

◆ free_state_change_info()

static void free_state_change_info ( MYSQL_EXTENSION ext)
static

◆ get_data_and_length()

static int get_data_and_length ( LIST node,
const char **  data,
size_t *  length 
)
static

Read data and its length from a LIST node.

Assumes LIST which stores data blobs in LEX_STRING structures, where LEX_STRING::str is pointer to the data and LEX_STRING::length is the length of this data.

If node is NULL then data and length are set to NULL and 0, respectively, and function returns 0, otherwise, if data has been read from the node, function returns 1.

◆ get_length_store_length()

static size_t get_length_store_length ( size_t  length)
static

◆ get_vio_connect_timeout()

static int get_vio_connect_timeout ( MYSQL mysql)
static

Convert the connect timeout option to a timeout value for VIO functions (vio_socket_connect() and vio_io_wait()).

Parameters
mysqlConnection handle (client side).
Returns
The timeout value in milliseconds, or -1 if no timeout.

◆ init_client_psi_keys()

void init_client_psi_keys ( void  )

◆ is_auth_next_factor_packet()

static bool is_auth_next_factor_packet ( MYSQL mysql)
static

Helper method to check if received packet is AuthNextFactor packet.

Parameters
[in]mysqlconnection handle
Return values
truepacket is AuthNextFactor packet
falseif its not AuthNextFactor packet

◆ is_OK_packet()

static bool is_OK_packet ( MYSQL mysql,
ulong  length 
)
static

◆ mpvio_info()

void mpvio_info ( Vio vio,
MYSQL_PLUGIN_VIO_INFO info 
)

fills MYSQL_PLUGIN_VIO_INFO structure with the information about the connection

◆ my_net_is_inited()

static bool my_net_is_inited ( NET net)
static

Is this NET instance initialized? my_net_init() and net_end()

◆ my_os_charset_to_mysql_charset()

const char * my_os_charset_to_mysql_charset ( const char *  csname)

◆ mysql_affected_rows()

uint64_t STDCALL mysql_affected_rows ( MYSQL mysql)

◆ mysql_autocommit()

bool STDCALL mysql_autocommit ( MYSQL mysql,
bool  auto_mode 
)

◆ mysql_autodetect_character_set()

static int mysql_autodetect_character_set ( MYSQL mysql)
static

◆ mysql_binlog_close()

void STDCALL mysql_binlog_close ( MYSQL mysql,
MYSQL_RPL rpl 
)

Close replication stream.

Parameters
mysqlConnection handle.
rplReplication stream information.

◆ mysql_binlog_fetch()

int STDCALL mysql_binlog_fetch ( MYSQL mysql,
MYSQL_RPL rpl 
)

Fetch one event from the server.

Read one packet and check its validity, set rpl->buffer and rpl->size accordingly.

Parameters
mysqlConnection handle.
rplReplication stream information.
Return values
-1Got error packet.
0Success.

◆ mysql_binlog_open()

int STDCALL mysql_binlog_open ( MYSQL mysql,
MYSQL_RPL rpl 
)

Open a new replication stream.

Compose and send COM_BINLOG_DUMP[_GTID] command using information in the MYSQL_RPL structure.

Caller must set the following MYSQL_RPL's slots: file_name_length, file_name, start_positions, server_id, flags and in case of MYSQL_RPL_GTID: gtid_set_size, gtid_set or fix_gtid_set/fix_gtid_set_arg which is used to compose command packet.

Note: we treat NULL rpl->file_name as an empty string. If rpl->file_name_length is 0, strlen(rpl->file_name) will be called to set it. If rpl->fix_gtid_set is not NULL it will be called to fill packet gtid set data (rpl->gtid_set is ignored).

Parameters
mysqlConnection handle.
rplReplication stream information.
Return values
-1Error.
0Success.

◆ mysql_close()

void STDCALL mysql_close ( MYSQL mysql)

◆ mysql_close_free()

void mysql_close_free ( MYSQL mysql)

◆ mysql_close_free_options()

void mysql_close_free_options ( MYSQL mysql)

◆ mysql_commit()

bool STDCALL mysql_commit ( MYSQL mysql)

◆ mysql_detach_stmt_list()

void mysql_detach_stmt_list ( LIST **  stmt_list,
const char *  func_name 
)

◆ mysql_errno()

uint STDCALL mysql_errno ( MYSQL mysql)

◆ mysql_error()

const char *STDCALL mysql_error ( MYSQL mysql)

◆ mysql_extension_bind_free()

void mysql_extension_bind_free ( MYSQL_EXTENSION ext)

◆ mysql_extension_free()

void mysql_extension_free ( MYSQL_EXTENSION ext)

◆ mysql_extension_init()

MYSQL_EXTENSION * mysql_extension_init ( MYSQL mysql)

◆ mysql_fetch_field()

MYSQL_FIELD *STDCALL mysql_fetch_field ( MYSQL_RES result)

◆ mysql_fetch_fields()

MYSQL_FIELD *STDCALL mysql_fetch_fields ( MYSQL_RES res)

◆ mysql_fetch_lengths()

ulong *STDCALL mysql_fetch_lengths ( MYSQL_RES res)

◆ mysql_fetch_row()

MYSQL_ROW STDCALL mysql_fetch_row ( MYSQL_RES res)

◆ mysql_fetch_row_nonblocking()

net_async_status STDCALL mysql_fetch_row_nonblocking ( MYSQL_RES res,
MYSQL_ROW row 
)

Reads next row of a result set in an asynchronous way.

Parameters
[in]resbuffer in which all rows are stored
[out]rowreturn pointer to one row from result set
Return values
NET_ASYNC_NOT_READYfetch operation not complete, retry again
NET_ASYNC_COMPLETEfetch operation complete

◆ mysql_field_count()

unsigned int STDCALL mysql_field_count ( MYSQL mysql)

◆ mysql_fill_packet_header()

static char * mysql_fill_packet_header ( MYSQL mysql,
char *  buff,
size_t  buff_size 
)
static

Fill in the beginning of the client reply packet.

Used to fill in the beginning of the client reply packet or the ssl request packet.

Parameters
mysqlThe mysql handler to operate
[out]buffThe buffer to receive the packet
buff_sizeThe max size of the buffer. Used in debug only.
Returns
one past to where the buffer is filled
See also
page_protocol_conn_packets_protocol_ssl_request send_client_reply_packet()

◆ mysql_free_result()

void STDCALL mysql_free_result ( MYSQL_RES result)

◆ mysql_free_result_nonblocking()

net_async_status STDCALL mysql_free_result_nonblocking ( MYSQL_RES result)

Frees the memory allocated for a result, set by APIs which would have returned rows.

Parameters
[in]resultbuffer which needs to be freed
Return values
NET_ASYNC_NOT_READYoperation not complete, retry again
NET_ASYNC_COMPLETEoperation complete

◆ mysql_free_ssl_session_data()

bool STDCALL mysql_free_ssl_session_data ( MYSQL mysql,
void *  data 
)

Free a saved SSL session serialization.

Frees the session serialization as returned by mysql_get_ssl_session_data()

Parameters
mysqlpointer to the mysql connection
datathe session data to dispose of
Return values
truefailure
falsesuccess

◆ mysql_get_connect_nonblocking_stage()

connect_stage STDCALL mysql_get_connect_nonblocking_stage ( MYSQL mysql)

◆ mysql_get_option()

int STDCALL mysql_get_option ( MYSQL mysql,
enum mysql_option  option,
const void *  arg 
)

Return the current values for the options settable through mysql_options()

Returns the current values for all of the connection options. Callers should not manipulate the returned data ! Data are valid at the time of returning them until the next C API CALL arg should always be a pointer to a variable of the appropriate type. type of variable, based on the parameter:

uint MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_READ_TIMEOUT, MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_PROTOCOL, MYSQL_OPT_SSL_MODE, MYSQL_OPT_RETRY_COUNT

bool MYSQL_OPT_COMPRESS, MYSQL_OPT_LOCAL_INFILE, MYSQL_REPORT_DATA_TRUNCATION, MYSQL_OPT_RECONNECT, MYSQL_ENABLE_CLEARTEXT_PLUGIN, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, MYSQL_OPT_OPTIONAL_RESULTSET_METADATA

const char * MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_SET_CLIENT_IP, MYSQL_OPT_BIND, MYSQL_PLUGIN_DIR, MYSQL_DEFAULT_AUTH, MYSQL_OPT_SSL_KEY, MYSQL_OPT_SSL_CERT, MYSQL_OPT_SSL_CA, MYSQL_OPT_SSL_CAPATH, MYSQL_OPT_SSL_CIPHER, MYSQL_OPT_TLS_CIPHERSUITES, MYSQL_OPT_SSL_CRL, MYSQL_OPT_SSL_CRLPATH, MYSQL_OPT_TLS_VERSION, MYSQL_SERVER_PUBLIC_KEY, MYSQL_OPT_SSL_FIPS_MODE, MYSQL_OPT_TLS_SNI_SERVERNAME

<none, error returned> MYSQL_OPT_NAMED_PIPE, MYSQL_OPT_CONNECT_ATTR_RESET, MYSQL_OPT_CONNECT_ATTR_DELETE, MYSQL_INIT_COMMAND

Parameters
mysqlThe MYSQL connection to operate on
optionThe option to return the value for
[out]argMust be non-null. Receives the current value.
Returns
status
Return values
0SUCCESS

◆ mysql_get_server_version()

ulong STDCALL mysql_get_server_version ( MYSQL mysql)

◆ mysql_get_socket_descriptor()

int mysql_get_socket_descriptor ( MYSQL mysql)

◆ mysql_get_ssl_cipher()

const char *STDCALL mysql_get_ssl_cipher ( MYSQL mysql)

◆ mysql_get_ssl_session_data()

void *STDCALL mysql_get_ssl_session_data ( MYSQL mysql,
unsigned int  n_ticket,
unsigned int *  out_len 
)

Get the current SSL session serialization.

Return the SSL session serialized (if any) used for current connection to the server. The caller needs to free the return value by calling mysql_free_ssl_session_data()

Parameters
mysqlpointer to the mysql connection
n_ticketthe ticket to return. Currently on 0 is supported.
[out]out_lenif a non-null is supplied, stores the length of data returned.
Return values
null-terminatedstring of the session serialization
nullpointer if not an SSL connection or error

◆ mysql_get_ssl_session_reused()

bool STDCALL mysql_get_ssl_session_reused ( MYSQL mysql)

Check if the current ssl session is reused.

Parameters
mysqlpointer to the mysql connection
Return values
falsenot SSL or session not reused
truesession reused

◆ mysql_info()

const char *STDCALL mysql_info ( MYSQL mysql)

◆ mysql_init()

MYSQL *STDCALL mysql_init ( MYSQL mysql)

◆ mysql_init_character_set()

int mysql_init_character_set ( MYSQL mysql)

◆ mysql_more_results()

bool STDCALL mysql_more_results ( MYSQL mysql)

◆ mysql_next_result()

int STDCALL mysql_next_result ( MYSQL mysql)

◆ mysql_num_fields()

unsigned int STDCALL mysql_num_fields ( MYSQL_RES res)

◆ mysql_num_rows()

my_ulonglong STDCALL mysql_num_rows ( MYSQL_RES res)

◆ mysql_options()

int STDCALL mysql_options ( MYSQL mysql,
enum mysql_option  option,
const void *  arg 
)

◆ mysql_options4()

int STDCALL mysql_options4 ( MYSQL mysql,
enum mysql_option  option,
const void *  arg1,
const void *  arg2 
)

◆ mysql_prepare_com_query_parameters()

static int mysql_prepare_com_query_parameters ( MYSQL mysql,
unsigned char **  pret_data,
unsigned long *  pret_data_length 
)
static

Helper function to serialize the parameters data.

Parameters
mysqlthe mysql handle
[out]pret_dataout pointer to the data. set to nullptr if there's no data
[out]pret_data_lengthlength of the data in pred_data. 0 if there's no data
Returns
operation status
Return values
non-zerofailed
zerosuccess. Check pret_*

◆ mysql_prune_stmt_list()

static void mysql_prune_stmt_list ( MYSQL mysql)
static

For use when the connection to the server has been lost (in which case the server has discarded all information about prepared statements associated with the connection).

Mark all statements in mysql->stmts by setting stmt->mysql= 0 if the statement has transitioned beyond the MYSQL_STMT_INIT_DONE state, and unlink the statement from the mysql->stmts list.

The remaining pruned list of statements (if any) is kept in mysql->stmts.

Parameters
mysqlpointer to the MYSQL object

◆ mysql_read_default_options()

void mysql_read_default_options ( struct st_mysql_options options,
const char *  filename,
const char *  group 
)

◆ mysql_real_connect()

MYSQL *STDCALL mysql_real_connect ( MYSQL mysql,
const char *  host,
const char *  user,
const char *  passwd,
const char *  db,
uint  port,
const char *  unix_socket,
ulong  client_flag 
)

◆ mysql_real_connect_nonblocking()

net_async_status STDCALL mysql_real_connect_nonblocking ( MYSQL mysql,
const char *  host,
const char *  user,
const char *  passwd,
const char *  db,
uint  port,
const char *  unix_socket,
ulong  client_flag 
)

This API attempts to initialize all the context needed to make an asynchronous connection followed by establishing a connection to MySQL database.

If this API returns NET_ASYNC_COMPLETE then connection is established else call this API from the client application until the status returned is NET_ASYNC_COMPLETE.

Parameters
[in]mysqlconnection handle
[in]hosthost name or IP address
[in]userlogin ID used to connect to host
[in]passwdpassword for this login ID
[in]dbdefault database to be set after connection
[in]portport number to use for connection
[in]unix_socketsocket file to use for connection
[in]client_flagflag to indidcate what client can handle
Return values
NET_ASYNC_COMPLETESuccess.
NET_ASYNC_ERRORError.

◆ mysql_real_query()

int STDCALL mysql_real_query ( MYSQL mysql,
const char *  query,
ulong  length 
)

◆ mysql_real_query_nonblocking()

net_async_status STDCALL mysql_real_query_nonblocking ( MYSQL mysql,
const char *  query,
ulong  length 
)

Executes the SQL statement pointed by query.

This sql statement length is set in length parameter. query string can contain multiple sql statements separated by semicolons. This function can return immediately with status set to NET_ASYNC_NOT_READY, in this case client application is expected to call this API until it returns NET_ASYNC_COMPLETE.

Parameters
[in]mysqlconnection handle
[in]queryquery string to be executed
[in]lengthlength of query
Return values
NET_ASYNC_ERRORquery execution failed
NET_ASYNC_NOT_READYquery not yet completed, call this API again
NET_ASYNC_COMPLETEquery execution finished

◆ mysql_reconnect()

bool mysql_reconnect ( MYSQL mysql)

◆ mysql_reset_connection()

int STDCALL mysql_reset_connection ( MYSQL mysql)

◆ mysql_reset_connection_nonblocking()

net_async_status STDCALL mysql_reset_connection_nonblocking ( MYSQL mysql)

◆ mysql_result_metadata()

enum_resultset_metadata STDCALL mysql_result_metadata ( MYSQL_RES result)

◆ mysql_rollback()

bool STDCALL mysql_rollback ( MYSQL mysql)

◆ mysql_select_db()

int STDCALL mysql_select_db ( MYSQL mysql,
const char *  db 
)

◆ mysql_send_query()

int STDCALL mysql_send_query ( MYSQL mysql,
const char *  query,
ulong  length 
)

◆ mysql_send_query_nonblocking()

net_async_status STDCALL mysql_send_query_nonblocking ( MYSQL mysql,
const char *  query,
ulong  length 
)

Wrapper around mysql_send_query_nonblocking_inner to be called externally.

Parameters
[in]mysqlconnection handle
[in]queryquery string to be executed
[in]lengthlength of query
Return values
NET_ASYNC_ERRORquery execution failed
NET_ASYNC_NOT_READYquery not yet completed, call this API again
NET_ASYNC_COMPLETEquery execution finished

◆ mysql_send_query_nonblocking_inner()

static net_async_status mysql_send_query_nonblocking_inner ( MYSQL mysql,
const char *  query,
ulong  length 
)
static

Executes the SQL statement pointed by query.

This API is called by mysql_real_query_nonblocking to send query to server in asynchronous way.

Parameters
[in]mysqlconnection handle
[in]queryquery string to be executed
[in]lengthlength of query
Return values
NET_ASYNC_ERRORquery execution failed
NET_ASYNC_NOT_READYquery not yet completed, call this API again
NET_ASYNC_COMPLETEquery execution finished

◆ mysql_session_track_get_first()

int STDCALL mysql_session_track_get_first ( MYSQL mysql,
enum enum_session_state_type  type,
const char **  data,
size_t *  length 
)

Get the first state change information received from the server.

Parameters
[in]mysqlmysql handle
[in]typestate change type
[out]databuffer to store the data
[out]lengthlength of the data
Returns
0 - Valid data stored 1 - No data

◆ mysql_session_track_get_next()

int STDCALL mysql_session_track_get_next ( MYSQL mysql,
enum enum_session_state_type  type,
const char **  data,
size_t *  length 
)

Get the subsequent state change information received from the server.

Parameters
[in]mysqlmysql handle
[in]typestate change type
[out]databuffer to store the data
[out]lengthlength of the data
Returns
0 - Valid data stored 1 - No data

◆ mysql_set_character_set()

int STDCALL mysql_set_character_set ( MYSQL mysql,
const char *  cs_name 
)

◆ mysql_set_character_set_with_default_collation()

static void mysql_set_character_set_with_default_collation ( MYSQL mysql)
static

◆ mysql_sqlstate()

const char *STDCALL mysql_sqlstate ( MYSQL mysql)

◆ mysql_ssl_free()

static void mysql_ssl_free ( MYSQL mysql)
static

◆ mysql_ssl_set()

bool STDCALL mysql_ssl_set ( MYSQL mysql,
const char *  key,
const char *  cert,
const char *  ca,
const char *  capath,
const char *  cipher 
)

◆ mysql_store_result()

MYSQL_RES *STDCALL mysql_store_result ( MYSQL mysql)

◆ mysql_store_result_nonblocking()

enum net_async_status STDCALL mysql_store_result_nonblocking ( MYSQL mysql,
MYSQL_RES **  result 
)

This API reads all result set sent by server in an asynchronous way.

Parameters
[in]mysqlconnection handle
[in]resultbuffer which holds all result sets.
Return values
NET_ASYNC_NOT_READYreading of result sets not complete
NET_ASYNC_COMPLETEcompleted this asynchronous operation

◆ mysql_use_result()

MYSQL_RES *STDCALL mysql_use_result ( MYSQL mysql)

◆ net_clear_error()

void net_clear_error ( NET net)

Clear possible error state of struct NET.

Parameters
netclear the state of the argument

◆ net_field_length_ll_safe()

my_ulonglong net_field_length_ll_safe ( MYSQL mysql,
uchar **  packet,
ulong  packet_length,
bool *  is_error 
)
inline

◆ opt_flush_ok_packet()

static bool opt_flush_ok_packet ( MYSQL mysql,
bool *  is_ok_packet 
)
static

Read a packet from network.

If it's an OK packet, flush it.

Returns
true if error, false otherwise. In case of success, is_ok_packet is set to true or false, based on what we got from network.

◆ prep_client_reply_packet()

static bool prep_client_reply_packet ( MCPVIO_EXT mpvio,
const uchar data,
int  data_len,
char **  buff_out,
int *  buff_len 
)
static

sends a client authentication packet (second packet in the 3-way handshake)

Parameters
mpvioThe connection to use
dataThe scramble to send
data_lenLength of data
buff_outBuffer holding client handshake packet
buff_lenLength of buffer holding client handshake packet
Return values
0ok
1error
See also
mysql_fill_packet_header() page_protocol_conn_packets_protocol_handshake_response

If server/client is configured to use zstd compression then set compression level if specified, else set level to a default value.

◆ read_com_query_metadata()

static int read_com_query_metadata ( MYSQL mysql,
uchar pos,
ulong  field_count 
)
static

Read resultset metadata returned by COM_QUERY command.

Parameters
[in]mysqlClient connection handle.
[in]posPosition in the packet where the metadata starts.
[in]field_countNumber of columns in the field descriptor.
Return values
0Success.
1Error.

◆ read_com_query_metadata_nonblocking()

static net_async_status read_com_query_metadata_nonblocking ( MYSQL mysql,
uchar pos,
ulong  field_count,
int *  res 
)
static

Read resultset metadata returned by COM_QUERY command in asynchronous way.

Parameters
[in]mysqlClient connection handle.
[in]posPosition in the packet where the metadata starts.
[in]field_countNumber of columns in the field descriptor.
[out]resset to false in case of success and true for error.
Return values
NET_ASYNC_NOT_READYmetadata resultset not read completely
NET_ASYNC_COMPLETEfinished reading metadata resultset

◆ read_ok_ex()

void read_ok_ex ( MYSQL mysql,
ulong  length 
)

Read Ok packet along with the server state change information.

◆ read_one_row()

static int read_one_row ( MYSQL mysql,
uint  fields,
MYSQL_ROW  row,
ulong *  lengths 
)
static

◆ read_one_row_complete()

static int read_one_row_complete ( MYSQL mysql,
ulong  pkt_len,
bool  is_data_packet,
uint  fields,
MYSQL_ROW  row,
ulong *  lengths 
)
static

◆ read_one_row_nonblocking()

static net_async_status read_one_row_nonblocking ( MYSQL mysql,
uint  fields,
MYSQL_ROW  row,
ulong *  lengths,
int *  res 
)
static

◆ reset_async_auth_data()

static void reset_async_auth_data ( mysql_async_auth ctx)
static

◆ reset_connection()

static void reset_connection ( MYSQL mysql)
static

◆ run_plugin_auth()

int run_plugin_auth ( MYSQL mysql,
char *  data,
uint  data_len,
const char *  data_plugin,
const char *  db 
)

Client side of the plugin driver authentication.

Note
this is used by both the mysql_real_connect and mysql_change_user
Parameters
mysqlmysql
datapointer to the plugin auth data (scramble) in the handshake packet
data_lenthe length of the data
data_plugina plugin that data were prepared for or 0 if it's mysql_change_user()
dbinitial db to use, can be 0
Return values
0ok
1error

◆ run_plugin_auth_nonblocking()

mysql_state_machine_status run_plugin_auth_nonblocking ( MYSQL mysql,
char *  data,
uint  data_len,
const char *  data_plugin,
const char *  db 
)

This functions drives the authentication on client side in a nonblocking way.

This function will call different modules in a sequence where each module is responsible to achieve a particular part in entire authentication phase.

Note
this is used by both the mysql_real_connect_nonblocking
Parameters
mysqlmysql
datapointer to the plugin auth data (scramble) in the handshake packet
data_lenthe length of the data
data_plugina plugin that data were prepared for or 0 if it's mysql_change_user()
dbinitial db to use, can be 0
Return values
NET_ASYNC_NOT_READYauthentication not yet complete
NET_ASYNC_COMPLETEauthentication done

◆ send_change_user_packet()

static int send_change_user_packet ( MCPVIO_EXT mpvio,
const uchar data,
int  data_len 
)
static

Sends a COM_CHANGE_USER with a caller provided payload.

Return values
0ok
1error

◆ send_client_connect_attrs()

uchar * send_client_connect_attrs ( MYSQL mysql,
uchar buf 
)

◆ send_client_reply_packet()

static int send_client_reply_packet ( MCPVIO_EXT mpvio,
const uchar data,
int  data_len 
)
static

◆ send_client_reply_packet_nonblocking()

static net_async_status send_client_reply_packet_nonblocking ( MCPVIO_EXT mpvio,
const uchar pkt,
int  pkt_len,
bool *  result 
)
static

◆ set_connect_attributes()

static int set_connect_attributes ( MYSQL mysql,
char *  buff,
size_t  buf_len 
)
static

set some default attributes

◆ set_load_data_local_infile_option()

static bool set_load_data_local_infile_option ( MYSQL mysql,
const char *  arg 
)
static

Validates, makes into an absolute path and sets MYSQL_OPT_LOAD_DATA_LOCAL_DIR value.

Parameters
mysqlconnection handle
argthe value to set. Can be null
Return values
truefailed
falsesuccess

◆ set_mysql_error()

void set_mysql_error ( MYSQL mysql,
int  errcode,
const char *  sqlstate 
)

Set the internal error message to mysql handler.

Parameters
mysqlconnection handle (client side)
errcodeCR_ error code, passed to ER macro to get error text
sqlstateSQL standard sqlstate

◆ set_mysql_extended_error()

void set_mysql_extended_error ( MYSQL mysql,
int  errcode,
const char *  sqlstate,
const char *  format,
  ... 
)

Set an error message on the client.

Parameters
mysqlconnection handle
errcodeCR_* errcode, for client errors
sqlstateSQL standard sql state, unknown_sqlstate for the majority of client errors.
formaterror message template, in sprintf format
...variable number of arguments

◆ set_query_idle()

void set_query_idle ( MYSQL_ASYNC async_context)
inline

Set async_context to idle status, free async_qp_data buffer.

Parameters
async_contextpointer to asynchronous context structure

◆ set_ssl_option_unpack_path()

static char * set_ssl_option_unpack_path ( const char *  arg)
static

◆ ssl_session_deserialize_from_data()

static SSL_SESSION * ssl_session_deserialize_from_data ( MYSQL mysql)
static

◆ ssl_session_deserialize_from_data_ptr()

static SSL_SESSION * ssl_session_deserialize_from_data_ptr ( MYSQL ,
char *  data 
)
static

◆ ssl_verify_server_cert()

static int ssl_verify_server_cert ( Vio vio,
const char *  server_hostname,
const char **  errptr 
)
static

◆ unpack_field()

static int unpack_field ( MYSQL mysql,
MEM_ROOT alloc,
bool  default_value,
uint  server_capabilities,
MYSQL_ROWS row,
MYSQL_FIELD field 
)
static

Read field metadata from field descriptor and store it in MYSQL_FIELD structure.

String values in MYSQL_FIELD are allocated in a given allocator root.

Parameters
mysqlconnection handle
allocmemory allocator root
default_valueflag telling if default values should be read from descriptor
server_capabilitiesprotocol capability flags which determine format of the descriptor
rowfield descriptor
fieldaddress of MYSQL_FIELD structure to store metadata in.
Returns
0 on success.

◆ unpack_fields()

MYSQL_FIELD * unpack_fields ( MYSQL mysql,
MYSQL_ROWS data,
MEM_ROOT alloc,
uint  fields,
bool  default_value,
uint  server_capabilities 
)

◆ use_result()

MYSQL_RES * use_result ( MYSQL mysql)

◆ write_length_encoded_string3()

static uchar * write_length_encoded_string3 ( uchar buf,
const char *  string,
size_t  length 
)
static

◆ write_length_encoded_string4()

static char * write_length_encoded_string4 ( char *  dest,
char *  dest_end,
const uchar src,
const uchar src_end 
)
static

◆ write_string()

static char * write_string ( char *  dest,
char *  dest_end,
const uchar src,
const uchar src_end 
)
static

Variable Documentation

◆ all_client_memory

PSI_memory_info all_client_memory[]
static
Initial value:
= {
{&key_memory_mysql_options, "mysql_options", 0, 0, PSI_DOCUMENT_ME},
{&key_memory_MYSQL_DATA, "MYSQL_DATA", 0, 0, PSI_DOCUMENT_ME},
{&key_memory_MYSQL, "MYSQL", 0, 0, PSI_DOCUMENT_ME},
{&key_memory_MYSQL_RES, "MYSQL_RES", 0, 0, PSI_DOCUMENT_ME},
{&key_memory_MYSQL_ROW, "MYSQL_ROW", 0, 0, PSI_DOCUMENT_ME},
{&key_memory_MYSQL_state_change_info, "MYSQL_STATE_CHANGE_INFO", 0, 0,
{&key_memory_MYSQL_HANDSHAKE, "MYSQL_HANDSHAKE", 0, 0, PSI_DOCUMENT_ME},
{&key_memory_MYSQL_ssl_session_data, "MYSQL_SSL_session", 0, 0,
"Saved SSL sessions"}}
#define PSI_DOCUMENT_ME
Definition: component_common.h:29
PSI_memory_key key_memory_MYSQL_DATA
Definition: client.cc:167
PSI_memory_key key_memory_MYSQL_ssl_session_data
Definition: client.cc:173
PSI_memory_key key_memory_MYSQL
Definition: client.cc:168
PSI_memory_key key_memory_MYSQL_state_change_info
Definition: client.cc:171
PSI_memory_key key_memory_mysql_options
Definition: client.cc:166
PSI_memory_key key_memory_MYSQL_RES
Definition: client.cc:169
PSI_memory_key key_memory_MYSQL_ROW
Definition: client.cc:170
PSI_memory_key key_memory_MYSQL_HANDSHAKE
Definition: client.cc:172

◆ caching_sha2_password_client_plugin

auth_plugin_t caching_sha2_password_client_plugin
static
Initial value:
= {
"SHA2 based authentication with salt",
{1, 0, 0},
"GPL",
nullptr,
nullptr,
nullptr,
int caching_sha2_password_deinit(void)
Definition: client_authentication.cc:587
int caching_sha2_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
Authenticate the client using the RSA or TLS and a SHA2 salted password.
Definition: client_authentication.cc:620
net_async_status caching_sha2_password_auth_client_nonblocking(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql, int *res)
non blocking version of caching_sha2_password_auth_client
Definition: client_authentication.cc:808
int caching_sha2_password_init(char *, size_t, int, va_list)
Definition: client_authentication.cc:585
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION
Definition: client_plugin.h:84
#define MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE
Definition: client_plugin.h:90
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN
Definition: client_plugin.h:80
#define caching_sha2_password_plugin_name
Definition: client.cc:163

◆ cant_connect_sqlstate

const char* cant_connect_sqlstate = "08001"

◆ charsets

const MY_CSET_OS_NAME charsets[]

◆ clear_password_client_plugin

auth_plugin_t clear_password_client_plugin
static
Initial value:
= {
"mysql_clear_password",
"Clear password authentication plugin",
{0, 1, 0},
"GPL",
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
static int clear_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
The main function of the mysql_clear_password authentication plugin.
Definition: client.cc:9587

◆ client_methods

MYSQL_METHODS client_methods
static
Initial value:
= {
,
}
MYSQL_DATA * cli_read_rows(MYSQL *mysql, MYSQL_FIELD *mysql_fields, unsigned int fields)
Definition: client.cc:2993
static MYSQL_ROW cli_fetch_row(MYSQL_RES *mysql_res)
Definition: client.cc:8373
net_async_status cli_read_rows_nonblocking(MYSQL *mysql, MYSQL_FIELD *mysql_fields, unsigned int fields, MYSQL_DATA **result_out)
Definition: client.cc:2851
net_async_status cli_read_change_user_result_nonblocking(MYSQL *mysql, ulong *ret)
Definition: client.cc:3224
static void cli_flush_use_result(MYSQL *mysql, bool flush_all_results)
Definition: client.cc:1794
net_async_status cli_advanced_command_nonblocking(MYSQL *mysql, enum enum_server_command command, const uchar *header, ulong header_length, const uchar *arg, ulong arg_length, bool skip_check, MYSQL_STMT *stmt, bool *ret)
Definition: client.cc:1504
static MYSQL * cli_connect(mysql_async_connect *ctx)
Definition: client.cc:6248
static MYSQL_RES * cli_use_result(MYSQL *mysql)
Definition: client.cc:8367
static void cli_fetch_lengths(ulong *to, MYSQL_ROW column, unsigned int field_count)
Definition: client.cc:2348
static bool cli_read_query_result(MYSQL *mysql)
Definition: client.cc:7693
static net_async_status cli_read_query_result_nonblocking(MYSQL *mysql)
Definition: client.cc:7744
static net_async_status cli_flush_use_result_nonblocking(MYSQL *mysql, bool flush_all_results)
Definition: client.cc:1777
bool cli_advanced_command(MYSQL *mysql, enum enum_server_command command, const uchar *header, size_t header_length, const uchar *arg, size_t arg_length, bool skip_check, MYSQL_STMT *stmt)
Definition: client.cc:1329
int cli_read_change_user_result(MYSQL *mysql)
Definition: client.cc:3220

◆ default_client_charset_info

CHARSET_INFO* default_client_charset_info = &my_charset_latin1

◆ default_options

const char* default_options[]
static

◆ g_max_allowed_packet

ulong g_max_allowed_packet = 1024L * 1024L * 1024L

◆ g_net_buffer_length

ulong g_net_buffer_length = 8192

◆ key_memory_MYSQL

PSI_memory_key key_memory_MYSQL

◆ key_memory_MYSQL_DATA

PSI_memory_key key_memory_MYSQL_DATA

◆ key_memory_MYSQL_HANDSHAKE

PSI_memory_key key_memory_MYSQL_HANDSHAKE

◆ key_memory_mysql_options

PSI_memory_key key_memory_mysql_options

◆ key_memory_MYSQL_RES

PSI_memory_key key_memory_MYSQL_RES

◆ key_memory_MYSQL_ROW

PSI_memory_key key_memory_MYSQL_ROW

◆ key_memory_MYSQL_ssl_session_data

PSI_memory_key key_memory_MYSQL_ssl_session_data

◆ key_memory_MYSQL_state_change_info

PSI_memory_key key_memory_MYSQL_state_change_info

◆ libmysql_cleartext_plugin_enabled

bool libmysql_cleartext_plugin_enabled = false

◆ mysql_client_builtins

struct st_mysql_client_plugin* mysql_client_builtins[]
Initial value:
= {
nullptr}
static auth_plugin_t clear_password_client_plugin
Definition: client.cc:4009
static auth_plugin_t caching_sha2_password_client_plugin
Definition: client.cc:4041
static auth_plugin_t sha256_password_client_plugin
Definition: client.cc:4025
Definition: client_plugin.h:114

◆ mysql_port

uint mysql_port = 0

◆ mysql_server_last_errno

unsigned int mysql_server_last_errno

◆ mysql_server_last_error

char mysql_server_last_error[MYSQL_ERRMSG_SIZE]

◆ mysql_unix_port

char* mysql_unix_port = nullptr

◆ not_error_sqlstate

const char* not_error_sqlstate = "00000"

◆ option_types

TYPELIB option_types
static
Initial value:
= {array_elements(default_options) - 1, "options",
default_options, nullptr}
static const char * default_options[]
Definition: client.cc:1985
#define array_elements(A)
Definition: validate_password_imp.cc:50

◆ sha256_password_client_plugin

auth_plugin_t sha256_password_client_plugin
static
Initial value:
= {
"sha256_password",
"SHA256 based authentication with salt",
{1, 0, 0},
"GPL",
nullptr,
nullptr,
nullptr,
net_async_status sha256_password_auth_client_nonblocking(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql, int *res)
Non blocking version of sha256_password_auth_client.
Definition: client_authentication.cc:438
int sha256_password_init(char *, size_t, int, va_list)
Definition: client_authentication.cc:64
int sha256_password_deinit(void)
Definition: client_authentication.cc:69
int sha256_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
Authenticate the client using the RSA or TLS and a SHA256 salted password.
Definition: client_authentication.cc:181

◆ sql_protocol_names_lib

const char* sql_protocol_names_lib[]
Initial value:
= {"TCP", "SOCKET", "PIPE", "MEMORY",
#define NullS
Definition of the null string (a null pointer of type char *), used in some of our string handling co...
Definition: nulls.h:33

◆ sql_protocol_typelib

TYPELIB sql_protocol_typelib
Initial value:
const char * sql_protocol_names_lib[]
Definition: client.cc:2075

◆ unknown_sqlstate

const char* unknown_sqlstate = "HY000"