MySQL 9.0.0
Source Code Documentation
|
#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 "config.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 |
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_FIELD * | unpack_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_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. More... | |
static int | alloc_field_alloc (MYSQL *mysql) |
MYSQL_FIELD * | cli_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_DATA * | cli_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_RES * | cli_use_result (MYSQL *mysql) |
static MYSQL_ROW | cli_fetch_row (MYSQL_RES *mysql_res) |
static MYSQL * | cli_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_EXTENSION * | mysql_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 uchar * | write_length_encoded_string3 (uchar *buf, const char *string, size_t length) |
uchar * | send_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... | |
MYSQL * | connect_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_RES * | use_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... | |
#define caching_sha2_password_plugin_name "caching_sha2_password" |
#define GTID_ENCODED_DATA_SIZE 8 |
#define INVALID_SOCKET -1 |
#define MAX_CONNECTION_ATTR_STORAGE_LENGTH 65536 |
#define MAX_VARIABLE_STRING_LENGTH 9 |
#define MYSQL_NATIVE_PASSWORD_PLUGIN_NAME "mysql_native_password" |
#define SSL_SESSION_is_resumable | ( | x | ) | true |
typedef enum my_cs_match_type_enum my_cs_match_type |
enum option_id |
|
static |
|
static |
|
static |
Asynchronous authentication phase is divided into several smaller chunks of subtasks like:
Determine the default/initial plugin to use.
All above tasks are implemented in below authsm_* functions where authsm stads for authentication state machine.
|
static |
Invoke client plugins authentication method.
|
static |
|
static |
Check if server asked to use a different authentication plugin.
|
static |
Handle the result of the first authenticate_user.
|
static |
Handle response from client plugins authentication method.
|
static |
|
static |
Start multi factor authentication.
|
static |
After the first authenticate_user comes a call to read the result of the implied change_user.
|
static |
Authentication can have two authenticate_user calls, depending on what the server responds with; this handles the first.
|
static |
Start the authentication process again with the plugin which server asked for.
|
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.
mysql | the handle that has the buffer |
packet | the current position in the buffer |
packet_length | the size of the packet |
bytes | the bytes that we want available |
true | the buffer has that many bytes |
false | the buffer has less bytes remaining |
|
static |
|
static |
The main function of the mysql_clear_password authentication plugin.
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 | ||
) |
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.
|
static |
Calculates client capabilities in effect (mysql->client_flag)
Needs to be called immediately after receiving the server handshake packet.
mysql | the connection context |
db | The database specified by the client app |
client_flag | The client flag as specified by the client app |
|
static |
|
static |
Establishes SSL if requested and supported.
mysql | the connection handle |
0 | success |
1 | failure |
|
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.
[in] | mysql | Client connection handle. |
[out] | res | set to false in case of success and true for error. |
NET_ASYNC_NOT_READY | ssl connection not yet established |
NET_ASYNC_COMPLETE | ssl connection established |
|
static |
|
static |
|
static |
int cli_read_change_user_result | ( | MYSQL * | mysql | ) |
net_async_status cli_read_change_user_result_nonblocking | ( | MYSQL * | mysql, |
ulong * | ret | ||
) |
MYSQL_FIELD * cli_read_metadata | ( | MYSQL * | mysql, |
ulong | field_count, | ||
unsigned int | field | ||
) |
Read metadata resultset from server.
[in] | mysql | connection handle |
[in] | field_count | total number of fields |
[in] | field | number of columns in single field descriptor |
an | array of field rows |
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.
[in] | mysql | connection handle |
[in] | alloc | memory allocator root |
[in] | field_count | total number of fields |
[in] | field | number of columns in single field descriptor |
an | array of field rows |
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.
[in] | mysql | connection handle |
[in] | alloc | memory allocator root |
[in] | field_count | total number of fields |
[in] | field | number of columns in single field descriptor |
[out] | ret | an array of field rows |
NET_ASYNC_NOT_READY | metadata resultset not read completely |
NET_ASYNC_COMPLETE | finished reading metadata resultset |
|
static |
Helper method to read metadata in asynchronous way.
|
static |
|
static |
MYSQL_DATA * cli_read_rows | ( | MYSQL * | mysql, |
MYSQL_FIELD * | mysql_fields, | ||
unsigned int | fields | ||
) |
net_async_status cli_read_rows_nonblocking | ( | MYSQL * | mysql, |
MYSQL_FIELD * | mysql_fields, | ||
unsigned int | fields, | ||
MYSQL_DATA ** | result_out | ||
) |
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").
[in] | mysql | connection handle |
[out] | is_data_packet | if set to true then the packet received was a "data packet". |
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. |
net_async_status cli_safe_read_nonblocking | ( | MYSQL * | mysql, |
bool * | is_data_packet, | ||
ulong * | res | ||
) |
Its a non blocking version of cli_safe_read.
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
[in] | mysql | connection handle |
[in] | parse_ok | if set to true then parse OK packet if it is received |
[out] | is_data_packet | if set to true then packet received is a "data packet", that is not OK or ERR packet or EOF in case of old servers |
|
static |
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.
[in] | mysql | connection handle |
[in] | parse_ok | if set to true then parse OK packet if it was sent by server |
[out] | is_data_packet | if set to true then the packet received was a "data packet". |
[out] | res | The length of the packet that was read or packet_error in case of error. |
NET_ASYNC_NOT_READY | packet was not completely read |
NET_ASYNC_COMPLETE | finished reading packet |
|
static |
|
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.
|
static |
vio->read_packet() nonblocking callback method for client authentication plugins
|
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.
|
static |
vio->write_packet() nonblocking callback method for client authentication plugins
MYSQL * connect_helper | ( | mysql_async_connect * | ctx | ) |
|
static |
Invoke the authentication client plugin API to send the authentication data to the server.
|
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.
Below are the modules which does all above tasks.
|
static |
Complete the connection itself, setting options on the now-connected socket.
|
static |
Establish SSL if needed.
|
static |
Parse the handshake from the server.
old server with no CLIENT_PLUGIN_AUTH support, so assume native auth
|
static |
Authenticated, set initial database if specified.
|
static |
Read the greeting from the server that is read the first packet.
|
static |
Wait for async connect attempt to complete.
void end_server | ( | MYSQL * | mysql | ) |
const char * fieldtype2str | ( | enum enum_field_types | type | ) |
Returns a string for a mysql field type.
type | the type of the field. |
|
static |
Finish reading of a partial result set from the server.
Get the EOF packet, and update mysql->status and mysql->warning_count.
|
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.
[in] | mysql | connection handle |
[out] | res | true in case of protocol error, false otherwise |
NET_ASYNC_NOT_READY | result set not flushed yet |
NET_ASYNC_COMPLETE | finished flushing result set |
|
inline |
Free async_qp_data buffer in async_context.
async_context | pointer to asynchronous context structure |
void free_old_query | ( | MYSQL * | mysql | ) |
void free_rows | ( | MYSQL_DATA * | cur | ) |
|
static |
|
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.
|
static |
|
static |
Convert the connect timeout option to a timeout value for VIO functions (vio_socket_connect() and vio_io_wait()).
mysql | Connection handle (client side). |
void init_client_psi_keys | ( | void | ) |
|
static |
Helper method to check if received packet is AuthNextFactor packet.
[in] | mysql | connection handle |
true | packet is AuthNextFactor packet |
false | if its not AuthNextFactor packet |
|
static |
void mpvio_info | ( | Vio * | vio, |
MYSQL_PLUGIN_VIO_INFO * | info | ||
) |
fills MYSQL_PLUGIN_VIO_INFO structure with the information about the connection
|
static |
Is this NET instance initialized? my_net_init()
and net_end()
const char * my_os_charset_to_mysql_charset | ( | const char * | csname | ) |
|
static |
Close replication stream.
mysql | Connection handle. |
rpl | Replication stream information. |
Fetch one event from the server.
Read one packet and check its validity, set rpl->buffer and rpl->size accordingly.
mysql | Connection handle. |
rpl | Replication stream information. |
-1 | Got error packet. |
0 | Success. |
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).
mysql | Connection handle. |
rpl | Replication stream information. |
-1 | Error. |
0 | Success. |
void mysql_close_free | ( | MYSQL * | mysql | ) |
void mysql_close_free_options | ( | MYSQL * | mysql | ) |
void mysql_detach_stmt_list | ( | LIST ** | stmt_list, |
const char * | func_name | ||
) |
void mysql_extension_bind_free | ( | MYSQL_EXTENSION * | ext | ) |
void mysql_extension_free | ( | MYSQL_EXTENSION * | ext | ) |
MYSQL_EXTENSION * mysql_extension_init | ( | MYSQL * | mysql | ) |
MYSQL_FIELD *STDCALL mysql_fetch_field | ( | MYSQL_RES * | result | ) |
MYSQL_FIELD *STDCALL mysql_fetch_fields | ( | 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.
[in] | res | buffer in which all rows are stored |
[out] | row | return pointer to one row from result set |
NET_ASYNC_NOT_READY | fetch operation not complete, retry again |
NET_ASYNC_COMPLETE | fetch operation complete |
|
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.
mysql | The mysql handler to operate | |
[out] | buff | The buffer to receive the packet |
buff_size | The max size of the buffer. Used in debug only. |
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.
[in] | result | buffer which needs to be freed |
NET_ASYNC_NOT_READY | operation not complete, retry again |
NET_ASYNC_COMPLETE | operation complete |
Free a saved SSL session serialization.
Frees the session serialization as returned by mysql_get_ssl_session_data()
mysql | pointer to the mysql connection |
data | the session data to dispose of |
true | failure |
false | success |
connect_stage STDCALL mysql_get_connect_nonblocking_stage | ( | MYSQL * | mysql | ) |
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
mysql | The MYSQL connection to operate on | |
option | The option to return the value for | |
[out] | arg | Must be non-null. Receives the current value. |
0 | SUCCESS |
int mysql_get_socket_descriptor | ( | 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.
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()
mysql | pointer to the mysql connection | |
n_ticket | the ticket to return. Currently on 0 is supported. | |
[out] | out_len | if a non-null is supplied, stores the length of data returned. |
null-terminated | string of the session serialization |
null | pointer if not an SSL connection or error |
Check if the current ssl session is reused.
mysql | pointer to the mysql connection |
false | not SSL or session not reused |
true | session reused |
int mysql_init_character_set | ( | MYSQL * | mysql | ) |
my_ulonglong STDCALL mysql_num_rows | ( | MYSQL_RES * | res | ) |
int STDCALL mysql_options | ( | MYSQL * | mysql, |
enum mysql_option | option, | ||
const void * | arg | ||
) |
int STDCALL mysql_options4 | ( | MYSQL * | mysql, |
enum mysql_option | option, | ||
const void * | arg1, | ||
const void * | arg2 | ||
) |
|
static |
Helper function to serialize the parameters data.
mysql | the mysql handle | |
[out] | pret_data | out pointer to the data. set to nullptr if there's no data |
[out] | pret_data_length | length of the data in pred_data. 0 if there's no data |
non-zero | failed |
zero | success. Check pret_* |
|
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.
mysql | pointer to the MYSQL object |
void mysql_read_default_options | ( | struct st_mysql_options * | options, |
const char * | filename, | ||
const char * | group | ||
) |
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.
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.
[in] | mysql | connection handle |
[in] | host | host name or IP address |
[in] | user | login ID used to connect to host |
[in] | passwd | password for this login ID |
[in] | db | default database to be set after connection |
[in] | port | port number to use for connection |
[in] | unix_socket | socket file to use for connection |
[in] | client_flag | flag to indidcate what client can handle |
NET_ASYNC_COMPLETE | Success. |
NET_ASYNC_ERROR | Error. |
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.
[in] | mysql | connection handle |
[in] | query | query string to be executed |
[in] | length | length of query |
NET_ASYNC_ERROR | query execution failed |
NET_ASYNC_NOT_READY | query not yet completed, call this API again |
NET_ASYNC_COMPLETE | query execution finished |
bool mysql_reconnect | ( | MYSQL * | mysql | ) |
net_async_status STDCALL mysql_reset_connection_nonblocking | ( | MYSQL * | mysql | ) |
enum_resultset_metadata STDCALL mysql_result_metadata | ( | MYSQL_RES * | result | ) |
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.
[in] | mysql | connection handle |
[in] | query | query string to be executed |
[in] | length | length of query |
NET_ASYNC_ERROR | query execution failed |
NET_ASYNC_NOT_READY | query not yet completed, call this API again |
NET_ASYNC_COMPLETE | query execution finished |
|
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.
[in] | mysql | connection handle |
[in] | query | query string to be executed |
[in] | length | length of query |
NET_ASYNC_ERROR | query execution failed |
NET_ASYNC_NOT_READY | query not yet completed, call this API again |
NET_ASYNC_COMPLETE | query execution finished |
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.
[in] | mysql | mysql handle |
[in] | type | state change type |
[out] | data | buffer to store the data |
[out] | length | length of the data |
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.
[in] | mysql | mysql handle |
[in] | type | state change type |
[out] | data | buffer to store the data |
[out] | length | length of the data |
|
static |
|
static |
bool STDCALL mysql_ssl_set | ( | MYSQL * | mysql, |
const char * | key, | ||
const char * | cert, | ||
const char * | ca, | ||
const char * | capath, | ||
const char * | cipher | ||
) |
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.
[in] | mysql | connection handle |
[in] | result | buffer which holds all result sets. |
NET_ASYNC_NOT_READY | reading of result sets not complete |
NET_ASYNC_COMPLETE | completed this asynchronous operation |
void net_clear_error | ( | NET * | net | ) |
Clear possible error state of struct NET.
net | clear the state of the argument |
|
inline |
|
static |
Read a packet from network.
If it's an OK packet, flush it.
|
static |
sends a client authentication packet (second packet in the 3-way handshake)
mpvio | The connection to use |
data | The scramble to send |
data_len | Length of data |
buff_out | Buffer holding client handshake packet |
buff_len | Length of buffer holding client handshake packet |
0 | ok |
1 | error |
If server/client is configured to use zstd compression then set compression level if specified, else set level to a default value.
Read resultset metadata returned by COM_QUERY command.
[in] | mysql | Client connection handle. |
[in] | pos | Position in the packet where the metadata starts. |
[in] | field_count | Number of columns in the field descriptor. |
0 | Success. |
1 | Error. |
|
static |
Read resultset metadata returned by COM_QUERY command in asynchronous way.
[in] | mysql | Client connection handle. |
[in] | pos | Position in the packet where the metadata starts. |
[in] | field_count | Number of columns in the field descriptor. |
[out] | res | set to false in case of success and true for error. |
NET_ASYNC_NOT_READY | metadata resultset not read completely |
NET_ASYNC_COMPLETE | finished reading metadata resultset |
void read_ok_ex | ( | MYSQL * | mysql, |
ulong | length | ||
) |
Read Ok packet along with the server state change information.
|
static |
|
static |
|
static |
|
static |
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.
mysql | mysql |
data | pointer to the plugin auth data (scramble) in the handshake packet |
data_len | the length of the data |
data_plugin | a plugin that data were prepared for or 0 if it's mysql_change_user() |
db | initial db to use, can be 0 |
0 | ok |
1 | error |
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.
mysql | mysql |
data | pointer to the plugin auth data (scramble) in the handshake packet |
data_len | the length of the data |
data_plugin | a plugin that data were prepared for or 0 if it's mysql_change_user() |
db | initial db to use, can be 0 |
NET_ASYNC_NOT_READY | authentication not yet complete |
NET_ASYNC_COMPLETE | authentication done |
|
static |
Sends a COM_CHANGE_USER with a caller provided payload.
0 | ok |
1 | error |
|
static |
|
static |
|
static |
set some default attributes
|
static |
Validates, makes into an absolute path and sets MYSQL_OPT_LOAD_DATA_LOCAL_DIR value.
mysql | connection handle |
arg | the value to set. Can be null |
true | failed |
false | success |
void set_mysql_error | ( | MYSQL * | mysql, |
int | errcode, | ||
const char * | sqlstate | ||
) |
Set the internal error message to mysql handler.
mysql | connection handle (client side) |
errcode | CR_ error code, passed to ER macro to get error text |
sqlstate | SQL standard sqlstate |
void set_mysql_extended_error | ( | MYSQL * | mysql, |
int | errcode, | ||
const char * | sqlstate, | ||
const char * | format, | ||
... | |||
) |
Set an error message on the client.
mysql | connection handle |
errcode | CR_* errcode, for client errors |
sqlstate | SQL standard sql state, unknown_sqlstate for the majority of client errors. |
format | error message template, in sprintf format |
... | variable number of arguments |
|
inline |
Set async_context to idle status, free async_qp_data buffer.
async_context | pointer to asynchronous context structure |
|
static |
|
static |
|
static |
|
static |
|
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.
mysql | connection handle |
alloc | memory allocator root |
default_value | flag telling if default values should be read from descriptor |
server_capabilities | protocol capability flags which determine format of the descriptor |
row | field descriptor |
field | address of MYSQL_FIELD structure to store metadata in. |
MYSQL_FIELD * unpack_fields | ( | MYSQL * | mysql, |
MYSQL_ROWS * | data, | ||
MEM_ROOT * | alloc, | ||
uint | fields, | ||
bool | default_value, | ||
uint | server_capabilities | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
const char* cant_connect_sqlstate = "08001" |
const MY_CSET_OS_NAME charsets[] |
|
static |
|
static |
CHARSET_INFO* default_client_charset_info = &my_charset_latin1 |
|
static |
ulong g_net_buffer_length = 8192 |
PSI_memory_key key_memory_MYSQL |
PSI_memory_key key_memory_MYSQL_DATA |
PSI_memory_key key_memory_MYSQL_HANDSHAKE |
PSI_memory_key key_memory_mysql_options |
PSI_memory_key key_memory_MYSQL_RES |
PSI_memory_key key_memory_MYSQL_ROW |
PSI_memory_key key_memory_MYSQL_ssl_session_data |
PSI_memory_key key_memory_MYSQL_state_change_info |
bool libmysql_cleartext_plugin_enabled = false |
struct st_mysql_client_plugin* mysql_client_builtins[] |
uint mysql_port = 0 |
unsigned int mysql_server_last_errno |
char mysql_server_last_error[MYSQL_ERRMSG_SIZE] |
char* mysql_unix_port = nullptr |
const char* not_error_sqlstate = "00000" |
|
static |
|
static |
const char* sql_protocol_names_lib[] |
TYPELIB sql_protocol_typelib |
const char* unknown_sqlstate = "HY000" |