MySQL 8.0.39
Source Code Documentation
libmysql.cc File Reference
#include "my_config.h"
#include <fcntl.h>
#include <limits.h>
#include <math.h>
#include <sys/types.h>
#include "m_ctype.h"
#include "m_string.h"
#include "my_alloc.h"
#include "my_sys.h"
#include "my_time.h"
#include "mysys_err.h"
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
#include <algorithm>
#include "errmsg.h"
#include "my_byteorder.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_double2ulonglong.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_macros.h"
#include "my_pointer_arithmetic.h"
#include "my_thread_local.h"
#include "mysql.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql_com.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include "template_utils.h"
#include "violite.h"
#include <pwd.h>
#include <sys/select.h>
#include <poll.h>
#include <sys/un.h>
#include "my_thread.h"
#include <memory>
#include "../sql-common/client_extensions_macros.h"
#include "client_settings.h"
#include "mysql_trace.h"
#include "sql_common.h"

Classes

struct  MYSQL_STMT_EXT
 
struct  default_local_infile_data
 

Macros

#define INADDR_NONE   -1
 
#define COM_SHUTDOWN_DEPRECATED   8
 
#define DEFAULT_PREFETCH_ROWS   (ulong)1
 
#define RESET_SERVER_SIDE   1
 
#define RESET_LONG_DATA   2
 
#define RESET_STORE_RESULT   4
 
#define RESET_CLEAR_ERROR   8
 
#define MAX_DOUBLE_STRING_REP_LENGTH   331
 
#define IS_TRUNCATED(value, is_unsigned, min, max, umax)
 
#define BIND_RESULT_DONE   1
 
#define REPORT_DATA_TRUNCATION   2
 

Functions

static void append_wild (char *to, char *end, const char *wild)
 
int STDCALL mysql_server_init (int argc, char **argv, char **groups)
 
void STDCALL mysql_server_end ()
 
bool STDCALL mysql_thread_init ()
 
void STDCALL mysql_thread_end ()
 
void STDCALL mysql_debug (const char *debug)
 
bool STDCALL mysql_change_user (MYSQL *mysql, const char *user, const char *passwd, const char *db)
 
void read_user_name (char *name)
 
static bool is_valid_local_infile_name (st_mysql_options *options, const char *net_filename)
 Checks if the file name supplied by the server is a valid name. More...
 
bool handle_local_infile (MYSQL *mysql, const char *net_filename)
 
static int default_local_infile_init (void **ptr, const char *filename, void *userdata)
 
static int default_local_infile_read (void *ptr, char *buf, uint buf_len)
 
static void default_local_infile_end (void *ptr)
 
static int default_local_infile_error (void *ptr, char *error_msg, uint error_msg_len)
 
void mysql_set_local_infile_handler (MYSQL *mysql, int(*local_infile_init)(void **, const char *, void *), int(*local_infile_read)(void *, char *, uint), void(*local_infile_end)(void *), int(*local_infile_error)(void *, char *, uint), void *userdata)
 
void mysql_set_local_infile_default (MYSQL *mysql)
 
int STDCALL mysql_query (MYSQL *mysql, const char *query)
 
void STDCALL mysql_data_seek (MYSQL_RES *result, uint64_t row)
 
MYSQL_ROW_OFFSET STDCALL mysql_row_seek (MYSQL_RES *result, MYSQL_ROW_OFFSET row)
 
MYSQL_FIELD_OFFSET STDCALL mysql_field_seek (MYSQL_RES *result, MYSQL_FIELD_OFFSET field_offset)
 
MYSQL_RES *STDCALL mysql_list_dbs (MYSQL *mysql, const char *wild)
 
MYSQL_RES *STDCALL mysql_list_tables (MYSQL *mysql, const char *wild)
 
MYSQL_FIELDcli_list_fields (MYSQL *mysql)
 
MYSQL_RES *STDCALL mysql_list_fields (MYSQL *mysql, const char *table, const char *wild)
 
MYSQL_RES *STDCALL mysql_list_processes (MYSQL *mysql)
 
int STDCALL mysql_shutdown (MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level)
 
int STDCALL mysql_refresh (MYSQL *mysql, uint options)
 
int STDCALL mysql_kill (MYSQL *mysql, ulong pid)
 
int STDCALL mysql_set_server_option (MYSQL *mysql, enum enum_mysql_set_option option)
 
int STDCALL mysql_dump_debug_info (MYSQL *mysql)
 
const char * cli_read_statistics (MYSQL *mysql)
 
const char *STDCALL mysql_stat (MYSQL *mysql)
 
int STDCALL mysql_ping (MYSQL *mysql)
 
const char *STDCALL mysql_get_server_info (MYSQL *mysql)
 
const char *STDCALL mysql_get_host_info (MYSQL *mysql)
 
uint STDCALL mysql_get_proto_info (MYSQL *mysql)
 
const char *STDCALL mysql_get_client_info (void)
 
ulong STDCALL mysql_get_client_version (void)
 
bool STDCALL mysql_eof (MYSQL_RES *res)
 
MYSQL_FIELD *STDCALL mysql_fetch_field_direct (MYSQL_RES *res, uint fieldnr)
 
MYSQL_ROW_OFFSET STDCALL mysql_row_tell (MYSQL_RES *res)
 
MYSQL_FIELD_OFFSET STDCALL mysql_field_tell (MYSQL_RES *res)
 
uint64_t STDCALL mysql_insert_id (MYSQL *mysql)
 
uint STDCALL mysql_warning_count (MYSQL *mysql)
 
ulong STDCALL mysql_thread_id (MYSQL *mysql)
 
const char *STDCALL mysql_character_set_name (MYSQL *mysql)
 
void STDCALL mysql_get_character_set_info (MYSQL *mysql, MY_CHARSET_INFO *csinfo)
 
uint STDCALL mysql_thread_safe (void)
 
void my_net_local_init (NET *net)
 
ulong STDCALL mysql_hex_string (char *to, const char *from, ulong length)
 
ulong STDCALL mysql_escape_string (char *to, const char *from, ulong length)
 
ulong STDCALL mysql_real_escape_string (MYSQL *mysql, char *to, const char *from, ulong length)
 Escapes special characters in a string for use in an SQL statement. More...
 
ulong STDCALL mysql_real_escape_string_quote (MYSQL *mysql, char *to, const char *from, ulong length, char quote)
 Escapes special characters in a string for use in an SQL statement. More...
 
void STDCALL myodbc_remove_escape (MYSQL *mysql, char *name)
 
static int stmt_read_row_unbuffered (MYSQL_STMT *stmt, unsigned char **row)
 
static int stmt_read_row_buffered (MYSQL_STMT *stmt, unsigned char **row)
 
static int stmt_read_row_from_cursor (MYSQL_STMT *stmt, unsigned char **row)
 
static int stmt_read_row_no_data (MYSQL_STMT *stmt, unsigned char **row)
 
static int stmt_read_row_no_result_set (MYSQL_STMT *stmt, unsigned char **row)
 
static void stmt_update_metadata (MYSQL_STMT *stmt, MYSQL_ROWS *data)
 
static bool setup_one_fetch_function (MYSQL_BIND *, MYSQL_FIELD *field)
 
static bool reset_stmt_handle (MYSQL_STMT *stmt, uint flags)
 
static void stmt_clear_error (MYSQL_STMT *stmt)
 
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. More...
 
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. More...
 
void set_stmt_errmsg (MYSQL_STMT *stmt, NET *net)
 Set statement error code, sqlstate, and error message from NET. More...
 
bool cli_read_prepare_result (MYSQL *mysql, MYSQL_STMT *stmt)
 
MYSQL_STMT *STDCALL mysql_stmt_init (MYSQL *mysql)
 
int STDCALL mysql_stmt_prepare (MYSQL_STMT *stmt, const char *query, ulong length)
 
static void alloc_stmt_fields (MYSQL_STMT *stmt)
 
static void update_stmt_fields (MYSQL_STMT *stmt)
 Update result set columns metadata if it was sent again in reply to COM_STMT_EXECUTE. More...
 
MYSQL_RES *STDCALL mysql_stmt_result_metadata (MYSQL_STMT *stmt)
 
MYSQL_RES *STDCALL mysql_stmt_param_metadata (MYSQL_STMT *stmt)
 
static int add_binary_row (NET *net, MYSQL_STMT *stmt, ulong pkt_len, MYSQL_ROWS ***prev_ptr)
 
static bool execute (MYSQL_STMT *stmt, char *packet, ulong length, bool send_param_count)
 Auxiliary function to send COM_STMT_EXECUTE packet to server and read reply. More...
 
int cli_stmt_execute (MYSQL_STMT *stmt)
 
bool STDCALL mysql_stmt_attr_set (MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *value)
 
bool STDCALL mysql_stmt_attr_get (MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, void *value)
 
static void reinit_result_set_metadata (MYSQL_STMT *stmt)
 Update statement result set metadata from with the new field information sent during statement execute. More...
 
static void prepare_to_fetch_result (MYSQL_STMT *stmt)
 
int STDCALL mysql_stmt_execute (MYSQL_STMT *stmt)
 
ulong STDCALL mysql_stmt_param_count (MYSQL_STMT *stmt)
 
uint64_t STDCALL mysql_stmt_affected_rows (MYSQL_STMT *stmt)
 
unsigned int STDCALL mysql_stmt_field_count (MYSQL_STMT *stmt)
 
uint64_t STDCALL mysql_stmt_insert_id (MYSQL_STMT *stmt)
 
bool STDCALL mysql_stmt_bind_param (MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
 
bool STDCALL mysql_bind_param (MYSQL *mysql, unsigned n_params, MYSQL_BIND *binds, const char **names)
 
bool STDCALL mysql_stmt_send_long_data (MYSQL_STMT *stmt, uint param_number, const char *data, ulong length)
 
static void read_binary_time (MYSQL_TIME *tm, uchar **pos)
 
static void read_binary_datetime (MYSQL_TIME *tm, uchar **pos)
 
static void read_binary_date (MYSQL_TIME *tm, uchar **pos)
 
static void fetch_string_with_conversion (MYSQL_BIND *param, char *value, size_t length)
 
template<class Int , class Float >
static Float convert_with_inexact_check (Int i, bool *is_inexact)
 
static void fetch_long_with_conversion (MYSQL_BIND *param, MYSQL_FIELD *field, longlong value, bool is_unsigned)
 
static void fetch_float_with_conversion (MYSQL_BIND *param, MYSQL_FIELD *field, double value, my_gcvt_arg_type type)
 
static void fetch_datetime_with_conversion (MYSQL_BIND *param, MYSQL_FIELD *field, MYSQL_TIME *my_time)
 
static void fetch_result_with_conversion (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_tinyint (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_short (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_int32 (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_int64 (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_float (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_double (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_time (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_date (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_datetime (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_bin (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void fetch_result_str (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void skip_result_fixed (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void skip_result_with_length (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static void skip_result_string (MYSQL_BIND *param, MYSQL_FIELD *field, uchar **row)
 
static bool is_binary_compatible (enum enum_field_types type1, enum enum_field_types type2)
 
bool STDCALL mysql_stmt_bind_result (MYSQL_STMT *stmt, MYSQL_BIND *my_bind)
 
static int stmt_fetch_row (MYSQL_STMT *stmt, uchar *row)
 
int cli_unbuffered_fetch (MYSQL *mysql, char **row)
 
int STDCALL mysql_stmt_fetch (MYSQL_STMT *stmt)
 
int STDCALL mysql_stmt_fetch_column (MYSQL_STMT *stmt, MYSQL_BIND *my_bind, uint column, ulong offset)
 
int cli_read_binary_rows (MYSQL_STMT *stmt)
 
int STDCALL mysql_stmt_store_result (MYSQL_STMT *stmt)
 
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek (MYSQL_STMT *stmt, MYSQL_ROW_OFFSET row)
 
MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell (MYSQL_STMT *stmt)
 
void STDCALL mysql_stmt_data_seek (MYSQL_STMT *stmt, uint64_t row)
 
uint64_t STDCALL mysql_stmt_num_rows (MYSQL_STMT *stmt)
 
bool STDCALL mysql_stmt_free_result (MYSQL_STMT *stmt)
 
bool STDCALL mysql_stmt_close (MYSQL_STMT *stmt)
 
bool STDCALL mysql_stmt_reset (MYSQL_STMT *stmt)
 
uint STDCALL mysql_stmt_errno (MYSQL_STMT *stmt)
 
const char *STDCALL mysql_stmt_sqlstate (MYSQL_STMT *stmt)
 
const char *STDCALL mysql_stmt_error (MYSQL_STMT *stmt)
 
net_async_status STDCALL mysql_next_result_nonblocking (MYSQL *mysql)
 
int STDCALL mysql_stmt_next_result (MYSQL_STMT *stmt)
 
bool STDCALL mysql_read_query_result (MYSQL *mysql)
 

Variables

static bool mysql_client_init = false
 
static bool org_my_init_done = false
 

Macro Definition Documentation

◆ BIND_RESULT_DONE

#define BIND_RESULT_DONE   1

◆ COM_SHUTDOWN_DEPRECATED

#define COM_SHUTDOWN_DEPRECATED   8

◆ DEFAULT_PREFETCH_ROWS

#define DEFAULT_PREFETCH_ROWS   (ulong)1

◆ INADDR_NONE

#define INADDR_NONE   -1

◆ IS_TRUNCATED

#define IS_TRUNCATED (   value,
  is_unsigned,
  min,
  max,
  umax 
)
Value:
((is_unsigned) ? (((value) > (umax) || (value) < 0) ? 1 : 0) \
: (((value) > (max) || (value) < (min)) ? 1 : 0))
constexpr value_type is_unsigned
Definition: classic_protocol_constants.h:273

◆ MAX_DOUBLE_STRING_REP_LENGTH

#define MAX_DOUBLE_STRING_REP_LENGTH   331

◆ REPORT_DATA_TRUNCATION

#define REPORT_DATA_TRUNCATION   2

◆ RESET_CLEAR_ERROR

#define RESET_CLEAR_ERROR   8

◆ RESET_LONG_DATA

#define RESET_LONG_DATA   2

◆ RESET_SERVER_SIDE

#define RESET_SERVER_SIDE   1

◆ RESET_STORE_RESULT

#define RESET_STORE_RESULT   4

Function Documentation

◆ add_binary_row()

static int add_binary_row ( NET net,
MYSQL_STMT stmt,
ulong  pkt_len,
MYSQL_ROWS ***  prev_ptr 
)
inlinestatic

◆ alloc_stmt_fields()

static void alloc_stmt_fields ( MYSQL_STMT stmt)
static

◆ append_wild()

static void append_wild ( char *  to,
char *  end,
const char *  wild 
)
static

◆ cli_list_fields()

MYSQL_FIELD * cli_list_fields ( MYSQL mysql)

◆ cli_read_binary_rows()

int cli_read_binary_rows ( MYSQL_STMT stmt)

◆ cli_read_prepare_result()

bool cli_read_prepare_result ( MYSQL mysql,
MYSQL_STMT stmt 
)

◆ cli_read_statistics()

const char * cli_read_statistics ( MYSQL mysql)

◆ cli_stmt_execute()

int cli_stmt_execute ( MYSQL_STMT stmt)

◆ cli_unbuffered_fetch()

int cli_unbuffered_fetch ( MYSQL mysql,
char **  row 
)

◆ convert_with_inexact_check()

template<class Int , class Float >
static Float convert_with_inexact_check ( Int  i,
bool *  is_inexact 
)
inlinestatic

◆ default_local_infile_end()

static void default_local_infile_end ( void *  ptr)
static

◆ default_local_infile_error()

static int default_local_infile_error ( void *  ptr,
char *  error_msg,
uint  error_msg_len 
)
static

◆ default_local_infile_init()

static int default_local_infile_init ( void **  ptr,
const char *  filename,
void *  userdata 
)
static

◆ default_local_infile_read()

static int default_local_infile_read ( void *  ptr,
char *  buf,
uint  buf_len 
)
static

◆ execute()

static bool execute ( MYSQL_STMT stmt,
char *  packet,
ulong  length,
bool  send_param_count 
)
static

Auxiliary function to send COM_STMT_EXECUTE packet to server and read reply.

Used from cli_stmt_execute, which is in turn used by mysql_stmt_execute.

Parameters
stmtthe stmt to execute
packetthe data for the parameters
lengthnumber of bytes in the buffer "data"
send_param_countON if the server properly processes the PARAMETER_COUNT_AVAILABLE flag, so we can send it.
Return values
falsesuccess
truefailure. error set

◆ fetch_datetime_with_conversion()

static void fetch_datetime_with_conversion ( MYSQL_BIND param,
MYSQL_FIELD field,
MYSQL_TIME my_time 
)
static

◆ fetch_float_with_conversion()

static void fetch_float_with_conversion ( MYSQL_BIND param,
MYSQL_FIELD field,
double  value,
my_gcvt_arg_type  type 
)
static

◆ fetch_long_with_conversion()

static void fetch_long_with_conversion ( MYSQL_BIND param,
MYSQL_FIELD field,
longlong  value,
bool  is_unsigned 
)
static

◆ fetch_result_bin()

static void fetch_result_bin ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_date()

static void fetch_result_date ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_datetime()

static void fetch_result_datetime ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_double()

static void fetch_result_double ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_float()

static void fetch_result_float ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_int32()

static void fetch_result_int32 ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_int64()

static void fetch_result_int64 ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_short()

static void fetch_result_short ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_str()

static void fetch_result_str ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_time()

static void fetch_result_time ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_tinyint()

static void fetch_result_tinyint ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_result_with_conversion()

static void fetch_result_with_conversion ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ fetch_string_with_conversion()

static void fetch_string_with_conversion ( MYSQL_BIND param,
char *  value,
size_t  length 
)
static

◆ handle_local_infile()

bool handle_local_infile ( MYSQL mysql,
const char *  net_filename 
)

◆ is_binary_compatible()

static bool is_binary_compatible ( enum enum_field_types  type1,
enum enum_field_types  type2 
)
static

◆ is_valid_local_infile_name()

static bool is_valid_local_infile_name ( st_mysql_options options,
const char *  net_filename 
)
static

Checks if the file name supplied by the server is a valid name.

Name is valid if it's either equal to or starts with the value stored in the mysql options. If the value in the options is NULL then no name is valid.

Note that we rely that the options name, if supplied, is normalized before being stored.

Note
Will allocate the extension if not already allocated
Parameters
optionsthe options to read the load_data_file_from.
net_filenamethe path to check
Return values
truethe name is valid
falsethe name is invalid

◆ my_net_local_init()

void my_net_local_init ( NET net)

◆ myodbc_remove_escape()

void STDCALL myodbc_remove_escape ( MYSQL mysql,
char *  name 
)

◆ mysql_bind_param()

bool STDCALL mysql_bind_param ( MYSQL mysql,
unsigned  n_params,
MYSQL_BIND binds,
const char **  names 
)

◆ mysql_change_user()

bool STDCALL mysql_change_user ( MYSQL mysql,
const char *  user,
const char *  passwd,
const char *  db 
)

◆ mysql_character_set_name()

const char *STDCALL mysql_character_set_name ( MYSQL mysql)

◆ mysql_data_seek()

void STDCALL mysql_data_seek ( MYSQL_RES result,
uint64_t  row 
)

◆ mysql_debug()

void STDCALL mysql_debug ( const char *  debug)

◆ mysql_dump_debug_info()

int STDCALL mysql_dump_debug_info ( MYSQL mysql)

◆ mysql_eof()

bool STDCALL mysql_eof ( MYSQL_RES res)

◆ mysql_escape_string()

ulong STDCALL mysql_escape_string ( char *  to,
const char *  from,
ulong  length 
)

◆ mysql_fetch_field_direct()

MYSQL_FIELD *STDCALL mysql_fetch_field_direct ( MYSQL_RES res,
uint  fieldnr 
)

◆ mysql_field_seek()

MYSQL_FIELD_OFFSET STDCALL mysql_field_seek ( MYSQL_RES result,
MYSQL_FIELD_OFFSET  field_offset 
)

◆ mysql_field_tell()

MYSQL_FIELD_OFFSET STDCALL mysql_field_tell ( MYSQL_RES res)

◆ mysql_get_character_set_info()

void STDCALL mysql_get_character_set_info ( MYSQL mysql,
MY_CHARSET_INFO csinfo 
)

◆ mysql_get_client_info()

const char *STDCALL mysql_get_client_info ( void  )

◆ mysql_get_client_version()

ulong STDCALL mysql_get_client_version ( void  )

◆ mysql_get_host_info()

const char *STDCALL mysql_get_host_info ( MYSQL mysql)

◆ mysql_get_proto_info()

uint STDCALL mysql_get_proto_info ( MYSQL mysql)

◆ mysql_get_server_info()

const char *STDCALL mysql_get_server_info ( MYSQL mysql)

◆ mysql_hex_string()

ulong STDCALL mysql_hex_string ( char *  to,
const char *  from,
ulong  length 
)

◆ mysql_insert_id()

uint64_t STDCALL mysql_insert_id ( MYSQL mysql)

◆ mysql_kill()

int STDCALL mysql_kill ( MYSQL mysql,
ulong  pid 
)

◆ mysql_list_dbs()

MYSQL_RES *STDCALL mysql_list_dbs ( MYSQL mysql,
const char *  wild 
)

◆ mysql_list_fields()

MYSQL_RES *STDCALL mysql_list_fields ( MYSQL mysql,
const char *  table,
const char *  wild 
)

◆ mysql_list_processes()

MYSQL_RES *STDCALL mysql_list_processes ( MYSQL mysql)

◆ mysql_list_tables()

MYSQL_RES *STDCALL mysql_list_tables ( MYSQL mysql,
const char *  wild 
)

◆ mysql_next_result_nonblocking()

net_async_status STDCALL mysql_next_result_nonblocking ( MYSQL mysql)

◆ mysql_ping()

int STDCALL mysql_ping ( MYSQL mysql)

◆ mysql_query()

int STDCALL mysql_query ( MYSQL mysql,
const char *  query 
)

◆ mysql_read_query_result()

bool STDCALL mysql_read_query_result ( MYSQL mysql)

◆ mysql_real_escape_string()

ulong STDCALL mysql_real_escape_string ( MYSQL mysql,
char *  to,
const char *  from,
ulong  length 
)

Escapes special characters in a string for use in an SQL statement.

Escapes special characters in the unescaped string, taking into account the current character set and sql mode of the connection so that is safe to place the string in a mysql_query(). This function must be used for binary data.

This function does not work correctly when NO_BACKSLASH_ESCAPES sql mode is used and string quote in the SQL statement is different than '\''.

Deprecated:
This function should not be used. Use mysql_real_escape_string_quote instead.
See also
mysql_real_escape_string_quote
Parameters
[in]mysqlMySQL connection structure.
[out]toEscaped string output buffer.
[in]fromString to escape.
[in]lengthString to escape length.
Returns
Result value.
Return values
!=(ulong)-1 Succeeded. Number of bytes written to the output buffer without the '\0' character.
(ulong)-1Failed. Use mysql_error() to get error message.

◆ mysql_real_escape_string_quote()

ulong STDCALL mysql_real_escape_string_quote ( MYSQL mysql,
char *  to,
const char *  from,
ulong  length,
char  quote 
)

Escapes special characters in a string for use in an SQL statement.

Escapes special characters in the unescaped string, taking into account the current character set and sql mode of the connection so that is safe to place the string in a mysql_query(). This function must be used for binary data.

This function should be used for escaping identifiers and string parameters.

Parameters
[in]mysqlMySQL connection structure.
[out]toEscaped string output buffer.
[in]fromString to escape.
[in]lengthString to escape length.
[in]quoteString quoting character used in an SQL statement. This should be one of '\'', '"' or '‘’ depending on the parameter quoting applied in the SQL statement.
Returns
Result value.
Return values
!=(ulong)-1 Succeeded. Number of bytes written to the output buffer without the '\0' character.
(ulong)-1Failed.

◆ mysql_refresh()

int STDCALL mysql_refresh ( MYSQL mysql,
uint  options 
)

◆ mysql_row_seek()

MYSQL_ROW_OFFSET STDCALL mysql_row_seek ( MYSQL_RES result,
MYSQL_ROW_OFFSET  row 
)

◆ mysql_row_tell()

MYSQL_ROW_OFFSET STDCALL mysql_row_tell ( MYSQL_RES res)

◆ mysql_server_end()

void STDCALL mysql_server_end ( void  )

◆ mysql_server_init()

int STDCALL mysql_server_init ( int  argc,
char **  argv,
char **  groups 
)

◆ mysql_set_local_infile_default()

void mysql_set_local_infile_default ( MYSQL mysql)

◆ mysql_set_local_infile_handler()

void mysql_set_local_infile_handler ( MYSQL mysql,
int(*)(void **, const char *, void *)  local_infile_init,
int(*)(void *, char *, uint local_infile_read,
void(*)(void *)  local_infile_end,
int(*)(void *, char *, uint local_infile_error,
void *  userdata 
)

◆ mysql_set_server_option()

int STDCALL mysql_set_server_option ( MYSQL mysql,
enum enum_mysql_set_option  option 
)

◆ mysql_shutdown()

int STDCALL mysql_shutdown ( MYSQL mysql,
enum mysql_enum_shutdown_level  shutdown_level 
)

◆ mysql_stat()

const char *STDCALL mysql_stat ( MYSQL mysql)

◆ mysql_stmt_affected_rows()

uint64_t STDCALL mysql_stmt_affected_rows ( MYSQL_STMT stmt)

◆ mysql_stmt_attr_get()

bool STDCALL mysql_stmt_attr_get ( MYSQL_STMT stmt,
enum enum_stmt_attr_type  attr_type,
void *  value 
)

◆ mysql_stmt_attr_set()

bool STDCALL mysql_stmt_attr_set ( MYSQL_STMT stmt,
enum enum_stmt_attr_type  attr_type,
const void *  value 
)

◆ mysql_stmt_bind_param()

bool STDCALL mysql_stmt_bind_param ( MYSQL_STMT stmt,
MYSQL_BIND my_bind 
)

◆ mysql_stmt_bind_result()

bool STDCALL mysql_stmt_bind_result ( MYSQL_STMT stmt,
MYSQL_BIND my_bind 
)

◆ mysql_stmt_close()

bool STDCALL mysql_stmt_close ( MYSQL_STMT stmt)

◆ mysql_stmt_data_seek()

void STDCALL mysql_stmt_data_seek ( MYSQL_STMT stmt,
uint64_t  row 
)

◆ mysql_stmt_errno()

uint STDCALL mysql_stmt_errno ( MYSQL_STMT stmt)

◆ mysql_stmt_error()

const char *STDCALL mysql_stmt_error ( MYSQL_STMT stmt)

◆ mysql_stmt_execute()

int STDCALL mysql_stmt_execute ( MYSQL_STMT stmt)

◆ mysql_stmt_fetch()

int STDCALL mysql_stmt_fetch ( MYSQL_STMT stmt)

◆ mysql_stmt_fetch_column()

int STDCALL mysql_stmt_fetch_column ( MYSQL_STMT stmt,
MYSQL_BIND my_bind,
uint  column,
ulong  offset 
)

◆ mysql_stmt_field_count()

unsigned int STDCALL mysql_stmt_field_count ( MYSQL_STMT stmt)

◆ mysql_stmt_free_result()

bool STDCALL mysql_stmt_free_result ( MYSQL_STMT stmt)

◆ mysql_stmt_init()

MYSQL_STMT *STDCALL mysql_stmt_init ( MYSQL mysql)

◆ mysql_stmt_insert_id()

uint64_t STDCALL mysql_stmt_insert_id ( MYSQL_STMT stmt)

◆ mysql_stmt_next_result()

int STDCALL mysql_stmt_next_result ( MYSQL_STMT stmt)

◆ mysql_stmt_num_rows()

uint64_t STDCALL mysql_stmt_num_rows ( MYSQL_STMT stmt)

◆ mysql_stmt_param_count()

ulong STDCALL mysql_stmt_param_count ( MYSQL_STMT stmt)

◆ mysql_stmt_param_metadata()

MYSQL_RES *STDCALL mysql_stmt_param_metadata ( MYSQL_STMT stmt)

◆ mysql_stmt_prepare()

int STDCALL mysql_stmt_prepare ( MYSQL_STMT stmt,
const char *  query,
ulong  length 
)

◆ mysql_stmt_reset()

bool STDCALL mysql_stmt_reset ( MYSQL_STMT stmt)

◆ mysql_stmt_result_metadata()

MYSQL_RES *STDCALL mysql_stmt_result_metadata ( MYSQL_STMT stmt)

◆ mysql_stmt_row_seek()

MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_seek ( MYSQL_STMT stmt,
MYSQL_ROW_OFFSET  row 
)

◆ mysql_stmt_row_tell()

MYSQL_ROW_OFFSET STDCALL mysql_stmt_row_tell ( MYSQL_STMT stmt)

◆ mysql_stmt_send_long_data()

bool STDCALL mysql_stmt_send_long_data ( MYSQL_STMT stmt,
uint  param_number,
const char *  data,
ulong  length 
)

◆ mysql_stmt_sqlstate()

const char *STDCALL mysql_stmt_sqlstate ( MYSQL_STMT stmt)

◆ mysql_stmt_store_result()

int STDCALL mysql_stmt_store_result ( MYSQL_STMT stmt)

◆ mysql_thread_end()

void STDCALL mysql_thread_end ( void  )

◆ mysql_thread_id()

ulong STDCALL mysql_thread_id ( MYSQL mysql)

◆ mysql_thread_init()

bool STDCALL mysql_thread_init ( void  )

◆ mysql_thread_safe()

uint STDCALL mysql_thread_safe ( void  )

◆ mysql_warning_count()

uint STDCALL mysql_warning_count ( MYSQL mysql)

◆ prepare_to_fetch_result()

static void prepare_to_fetch_result ( MYSQL_STMT stmt)
static

◆ read_binary_date()

static void read_binary_date ( MYSQL_TIME tm,
uchar **  pos 
)
static

◆ read_binary_datetime()

static void read_binary_datetime ( MYSQL_TIME tm,
uchar **  pos 
)
static

◆ read_binary_time()

static void read_binary_time ( MYSQL_TIME tm,
uchar **  pos 
)
static

◆ read_user_name()

void read_user_name ( char *  name)

◆ reinit_result_set_metadata()

static void reinit_result_set_metadata ( MYSQL_STMT stmt)
static

Update statement result set metadata from with the new field information sent during statement execute.

Precondition
mysql->field_count is not zero

◆ reset_stmt_handle()

static bool reset_stmt_handle ( MYSQL_STMT stmt,
uint  flags 
)
static

◆ set_stmt_errmsg()

void set_stmt_errmsg ( MYSQL_STMT stmt,
NET net 
)

Set statement error code, sqlstate, and error message from NET.

Parameters
stmta statement handle. Copy the error here.
netmysql->net. Source of the error.

◆ set_stmt_error()

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.

◆ set_stmt_extended_error()

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.

◆ setup_one_fetch_function()

static bool setup_one_fetch_function ( MYSQL_BIND param,
MYSQL_FIELD field 
)
static

◆ skip_result_fixed()

static void skip_result_fixed ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ skip_result_string()

static void skip_result_string ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ skip_result_with_length()

static void skip_result_with_length ( MYSQL_BIND param,
MYSQL_FIELD field,
uchar **  row 
)
static

◆ stmt_clear_error()

static void stmt_clear_error ( MYSQL_STMT stmt)
static

◆ stmt_fetch_row()

static int stmt_fetch_row ( MYSQL_STMT stmt,
uchar row 
)
static

◆ stmt_read_row_buffered()

static int stmt_read_row_buffered ( MYSQL_STMT stmt,
unsigned char **  row 
)
static

◆ stmt_read_row_from_cursor()

static int stmt_read_row_from_cursor ( MYSQL_STMT stmt,
unsigned char **  row 
)
static

◆ stmt_read_row_no_data()

static int stmt_read_row_no_data ( MYSQL_STMT stmt,
unsigned char **  row 
)
static

◆ stmt_read_row_no_result_set()

static int stmt_read_row_no_result_set ( MYSQL_STMT stmt,
unsigned char **  row 
)
static

◆ stmt_read_row_unbuffered()

static int stmt_read_row_unbuffered ( MYSQL_STMT stmt,
unsigned char **  row 
)
static

◆ stmt_update_metadata()

static void stmt_update_metadata ( MYSQL_STMT stmt,
MYSQL_ROWS data 
)
static

◆ update_stmt_fields()

static void update_stmt_fields ( MYSQL_STMT stmt)
static

Update result set columns metadata if it was sent again in reply to COM_STMT_EXECUTE.

Note
If the new field count is different from the original one, an error is set and no update is performed.

Variable Documentation

◆ mysql_client_init

bool mysql_client_init = false
static

◆ org_my_init_done

bool org_my_init_done = false
static