1#ifndef SQL_COMMON_INCLUDED
2#define SQL_COMMON_INCLUDED
51#ifdef IMPORT_UNKNOWN_SQLSTATE
97struct st_mysql_trace_info;
127#define MYSQL_EXTENSION_PTR(H) \
128 ((MYSQL_EXTENSION *)((H)->extension \
130 : ((H)->extension = mysql_extension_init(H))))
132#define ASYNC_DATA(M) \
133 (NULL != (M) ? (MYSQL_EXTENSION_PTR(M)->mysql_async_context) : NULL)
159#define MAX_AUTHENTICATION_FACTOR 3
195#define MYSQL_OPTIONS_EXTENSION_PTR(H, what) \
196 ((H)->options.extension ? (H)->options.extension->what : nullptr)
202 const unsigned char *header,
size_t header_length,
203 const unsigned char *arg,
size_t arg_length,
206 unsigned int fields);
210 unsigned int field_count);
213#if !defined(MYSQL_SERVER) && !defined(MYSQL_COMPONENT)
218 int (*unbuffered_fetch)(
MYSQL *
mysql,
char **row);
221 int (*read_rows_from_cursor)(
MYSQL_STMT *stmt);
227 const unsigned char *header,
unsigned long header_length,
228 const unsigned char *arg,
unsigned long arg_length,
bool skip_check,
235 bool flush_all_results);
241#define simple_command(mysql, command, arg, length, skip_check) \
243 ? (*(mysql)->methods->advanced_command)(mysql, command, 0, 0, arg, \
244 length, skip_check, NULL) \
245 : (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), \
247#define simple_command_nonblocking(mysql, command, arg, length, skip_check, \
249 (*(mysql)->methods->advanced_command_nonblocking)( \
250 mysql, command, 0, 0, arg, length, skip_check, NULL, error)
252#define stmt_command(mysql, command, arg, length, stmt) \
254 ? (*(mysql)->methods->advanced_command)(mysql, command, 0, 0, arg, \
256 : (set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate), \
261 uint fields,
bool default_value,
262 uint server_capabilities);
264 unsigned long field_count,
265 unsigned int fields);
267 unsigned int fields);
275 const char *
filename,
const char *group);
277 const unsigned char *header,
size_t header_length,
278 const unsigned char *arg,
size_t arg_length,
282 bool *is_data_packet,
285 bool *is_data_packet);
290 const char *sqlstate,
const char *format, ...)
291 MY_ATTRIBUTE((format(printf, 4, 5)));
294 const
char *format, ...)
295 MY_ATTRIBUTE((format(printf, 4, 5)));
302 const
char *data_plugin, const
char *db);
317 unsigned long n_param_sets,
uchar **ret_data, ulong *ret_length,
318 uchar send_types_to_server,
bool send_named_params,
319 bool send_parameter_set_count,
bool send_parameter_count_when_zero);
325#define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41)
330#define AUTH_NEXT_FACTOR_PACKETTYPE 2
Error messages for MySQL clients.
enum_server_command
A list of all MySQL protocol commands.
Definition: my_command.h:47
Header for compiler-dependent features.
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:51
static const char * filepath
Definition: myisamlog.cc:96
static MYSQL mysql
Definition: mysql.cc:165
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
char ** MYSQL_ROW
Definition: mysql.h:144
Common definition between mysql server & client.
#define MYSQL_VIO
Definition: mysql_com.h:893
#define SESSION_TRACK_END
End of enum_session_state_type.
Definition: mysql_com.h:1081
Definitions private to the server, used in the networking layer to notify specific events.
Definition: buf0block_hint.cc:29
Json_data_extension ext
Definition: backend.cc:50
Definition: instrumented_condition_variable.h:29
Definition: options.cc:56
const char * filename
Definition: pfs_example_component_population.cc:66
struct result result
Definition: result.h:33
net_async_status
Definition: plugin_auth_common.h:135
void mysql_extension_bind_free(MYSQL_EXTENSION *ext)
Definition: client.cc:3365
const char * unknown_sqlstate
Definition: client.cc:217
void set_stmt_extended_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate, const char *format,...)
Set statement error code, sqlstate, and error message from given errcode and sqlstate.
Definition: libmysql.cc:1208
void mysql_close_free(MYSQL *mysql)
Definition: client.cc:7539
void set_stmt_errmsg(MYSQL_STMT *stmt, NET *net)
Set statement error code, sqlstate, and error message from NET.
Definition: libmysql.cc:1229
void end_server(MYSQL *mysql)
Definition: client.cc:1890
void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate, const char *format,...)
Set an error message on the client.
Definition: client.cc:388
bool libmysql_cleartext_plugin_enabled
Definition: client.cc:5567
bool fix_param_bind(MYSQL_BIND *param, uint idx)
Definition: bind_params.cc:408
bool mysql_reconnect(MYSQL *mysql)
Definition: client.cc:7208
int mysql_client_plugin_init()
Initializes the client plugin layer.
Definition: client_plugin.cc:335
#define MYSQL_EXTENSION_PTR(H)
Definition: sql_common.h:127
MYSQL_FIELD * cli_read_metadata(MYSQL *mysql, unsigned long field_count, unsigned int fields)
void mpvio_info(MYSQL_VIO vio, MYSQL_PLUGIN_VIO_INFO *info)
void net_clear_error(NET *net)
Clear possible error state of struct NET.
Definition: client.cc:371
const char * cant_connect_sqlstate
Definition: client.cc:219
unsigned long cli_safe_read(MYSQL *mysql, bool *is_data_packet)
Read a packet from server.
Definition: client.cc:1312
MYSQL_RES * use_result(MYSQL *mysql)
Definition: client.cc:8304
void read_ok_ex(MYSQL *mysql, unsigned long len)
enum net_async_status cli_safe_read_nonblocking(MYSQL *mysql, bool *is_data_packet, ulong *res)
Its a non blocking version of cli_safe_read.
Definition: client.cc:1157
bool cli_advanced_command(MYSQL *mysql, enum enum_server_command command, const unsigned char *header, size_t header_length, const unsigned char *arg, size_t arg_length, bool skip_check, MYSQL_STMT *stmt)
Definition: client.cc:1324
void free_rows(MYSQL_DATA *cur)
Definition: client.cc:1316
void mysql_client_plugin_deinit()
Deinitializes the client plugin layer.
Definition: client_plugin.cc:375
unsigned long cli_safe_read_with_ok(MYSQL *mysql, bool parse_ok, bool *is_data_packet)
Read a packet from server.
Definition: client.cc:1179
bool mysql_int_serialize_param_data(NET *net, unsigned int param_count, MYSQL_BIND *params, const char **names, unsigned long n_param_sets, uchar **ret_data, ulong *ret_length, uchar send_types_to_server, bool send_named_params, bool send_parameter_set_count, bool send_parameter_count_when_zero)
Serialize the query parameters.
Definition: bind_params.cc:311
int is_file_or_dir_world_writable(const char *filepath)
Check if a file/dir is world-writable (only on non-Windows platforms)
Definition: my_path_permissions.cc:42
MYSQL_FIELD * cli_read_metadata_ex(MYSQL *mysql, MEM_ROOT *alloc, unsigned long field_count, unsigned int fields)
MYSQL * connect_helper(mysql_async_connect *ctx)
Definition: client.cc:6211
MYSQL_FIELD * unpack_fields(MYSQL *mysql, MYSQL_ROWS *data, MEM_ROOT *alloc, uint fields, bool default_value, uint server_capabilities)
Definition: client.cc:2493
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.
Definition: client.cc:5635
void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate)
Set the internal error message to mysql handler.
Definition: client.cc:340
#define MAX_AUTHENTICATION_FACTOR
Definition: sql_common.h:159
CHARSET_INFO * default_client_charset_info
Definition: client.cc:229
void free_old_query(MYSQL *mysql)
Definition: client.cc:1615
uchar * send_client_connect_attrs(MYSQL *mysql, uchar *buf)
Definition: client.cc:4119
const char * not_error_sqlstate
Definition: client.cc:218
MYSQL_EXTENSION * mysql_extension_init(MYSQL *)
Definition: client.cc:3344
void set_stmt_error(MYSQL_STMT *stmt, int errcode, const char *sqlstate)
Set statement error code, sqlstate, and error message from given errcode and sqlstate.
Definition: libmysql.cc:1193
void mysql_close_free_options(MYSQL *mysql)
Definition: client.cc:7498
void mysql_extension_set_server_extn(MYSQL *mysql, NET_SERVER *extn)
Sets the MYSQL_EXTENSION::server_extn attribute by the use of NET_SERVER which contains information a...
Definition: sql_common.h:151
void mysql_extension_free(MYSQL_EXTENSION *)
Definition: client.cc:3376
struct st_mysql_client_plugin * mysql_client_builtins[]
Definition: client.cc:4090
void mysql_read_default_options(struct st_mysql_options *options, const char *filename, const char *group)
Definition: client.cc:2108
Definition: m_ctype.h:422
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: mysql_async.h:211
Definition: sql_common.h:100
char ** names
Definition: sql_common.h:113
uint n_params
Definition: sql_common.h:112
struct MYSQL_ASYNC * mysql_async_context
Definition: sql_common.h:104
NET_SERVER * server_extn
Definition: sql_common.h:107
struct MYSQL_EXTENSION::@9 bind_info
struct st_mysql_trace_info * trace_data
Definition: sql_common.h:101
STATE_INFO state_change
Definition: sql_common.h:102
void * mcs_extn
Definition: sql_common.h:109
MYSQL_BIND * bind
Definition: sql_common.h:114
Definition: sql_common.h:198
enum net_async_status(* advanced_command_nonblocking)(MYSQL *mysql, enum enum_server_command command, const unsigned char *header, unsigned long header_length, const unsigned char *arg, unsigned long arg_length, bool skip_check, MYSQL_STMT *stmt, bool *error)
Definition: sql_common.h:225
MYSQL_ROW(* fetch_row)(MYSQL_RES *)
Definition: sql_common.h:208
enum net_async_status(* read_change_user_result_nonblocking)(MYSQL *mysql, ulong *res)
Definition: sql_common.h:237
bool(* read_query_result)(MYSQL *mysql)
Definition: sql_common.h:200
void(* fetch_lengths)(unsigned long *to, MYSQL_ROW column, unsigned int field_count)
Definition: sql_common.h:209
bool(* advanced_command)(MYSQL *mysql, enum enum_server_command command, const unsigned char *header, size_t header_length, const unsigned char *arg, size_t arg_length, bool skip_check, MYSQL_STMT *stmt)
Definition: sql_common.h:201
enum net_async_status(* read_rows_nonblocking)(MYSQL *mysql, MYSQL_FIELD *mysql_fields, unsigned int fields, MYSQL_DATA **result)
Definition: sql_common.h:230
void(* flush_use_result)(MYSQL *mysql, bool flush_all_results)
Definition: sql_common.h:211
enum net_async_status(* read_query_result_nonblocking)(MYSQL *mysql)
Definition: sql_common.h:224
enum net_async_status(* next_result_nonblocking)(MYSQL *mysql)
Definition: sql_common.h:236
int(* read_change_user_result)(MYSQL *mysql)
Definition: sql_common.h:212
enum net_async_status(* flush_use_result_nonblocking)(MYSQL *mysql, bool flush_all_results)
Definition: sql_common.h:234
Definition: plugin_auth_common.h:120
Definition: client.cc:4115
Definition: mysql_com_server.h:58
Definition: mysql_com.h:912
The structure is used to hold the state change information received from the server.
Definition: sql_common.h:75
LIST * head_node
head_node->data is a LEX_STRING which contains the variable name.
Definition: sql_common.h:77
LIST * current_node
Definition: sql_common.h:78
Store the change info received from the server in an array of linked lists with STATE_INFO_NODE eleme...
Definition: sql_common.h:85
STATE_INFO_NODE info_list[SESSION_TRACK_END+1]
Array of STATE_NODE_INFO elements (one per state type).
Definition: sql_common.h:87
Definition: sql_common.h:164
char * plugin_name
Definition: sql_common.h:165
char * password
Definition: sql_common.h:166
Definition: client_async_authentication.h:161
Definition: client_plugin.h:113
Definition: sql_common.h:169
unsigned int ssl_fips_mode
Definition: sql_common.h:183
bool get_server_public_key
Definition: sql_common.h:178
char * default_auth
Definition: sql_common.h:171
char * compression_algorithm
Definition: sql_common.h:185
long ssl_ctx_flags
Definition: sql_common.h:180
char * ssl_crl
Definition: sql_common.h:172
char * tls_version
Definition: sql_common.h:179
void * ssl_session_data
Definition: sql_common.h:191
bool connection_compressed
Definition: sql_common.h:188
char * plugin_dir
Definition: sql_common.h:170
unsigned int retry_count
Definition: sql_common.h:182
bool enable_cleartext_plugin
Definition: sql_common.h:177
char * tls_ciphersuites
Definition: sql_common.h:184
struct client_authentication_info client_auth_info[MAX_AUTHENTICATION_FACTOR]
Definition: sql_common.h:190
unsigned int total_configured_compression_algorithms
Definition: sql_common.h:186
char * server_public_key_path
Definition: sql_common.h:175
size_t connection_attributes_length
Definition: sql_common.h:176
struct My_hash * connection_attributes
Definition: sql_common.h:174
unsigned int ssl_mode
Definition: sql_common.h:181
char * tls_sni_servername
the session serialization to use
Definition: sql_common.h:192
char * ssl_crlpath
Definition: sql_common.h:173
char * load_data_dir
Definition: sql_common.h:189
unsigned int zstd_compression_level
Definition: sql_common.h:187
command
Definition: version_token.cc:279