MySQL  8.0.16
Source Code Documentation
mysql.cc File Reference
#include "my_config.h"
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <time.h>
#include "client/client_priv.h"
#include "client/my_readline.h"
#include "client/pattern_matcher.h"
#include "lex_string.h"
#include "m_ctype.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_default.h"
#include "my_dir.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_loglevel.h"
#include "my_macros.h"
#include "typelib.h"
#include "violite.h"
#include <readline.h>
#include <syslog.h>
#include <mysqld_error.h>
#include <algorithm>
#include <new>
#include "sql_common.h"
#include "sql/net_ns.h"
#include "sql_string.h"
#include "client/completion_hash.h"
#include "print_version.h"
#include "welcome_copyright_notice.h"
#include "caching_sha2_passwordopt-vars.h"
#include "sslopt-vars.h"
#include "caching_sha2_passwordopt-longopts.h"
#include "sslopt-longopts.h"
#include "sslopt-case.h"
#include <sys/times.h>

Classes

struct  STATUS
 
struct  COMMANDS
 
struct  _hist_entry
 

Macros

#define HAVE_READLINE
 
#define USE_POPEN
 
#define MAX_COLUMN_LENGTH   1024
 
#define MAX_SERVER_ARGS   64
 
#define MAX_ALLOCA_SIZE   512
 
#define cmp_database(cs, A, B)   strcmp((A), (B))
 
#define PROMPT_CHAR   '\\'
 
#define DEFAULT_DELIMITER   ";"
 
#define MAX_BATCH_BUFFER_SIZE   (1024L * 1024L * 1024L)
 
#define MY_PRINT_ESC_0   1 /* Replace 0x00 bytes to "\0" */
 
#define MY_PRINT_SPS_0   2 /* Replace 0x00 bytes to space */
 
#define MY_PRINT_XML   4 /* Encode XML entities */
 
#define MY_PRINT_MB   8 /* Recognize multi-byte characters */
 
#define MY_PRINT_CTRL   16 /* Replace TAB, NL, CR to "\t", "\n", "\r" */
 
#define ff2s_check_flag(X)
 

Typedefs

typedef enum enum_info_type INFO_TYPE
 
typedef struct _hist_entry HIST_ENTRY
 

Enumerations

enum  enum_info_type { INFO_INFO, INFO_ERROR, INFO_RESULT }
 

Functions

static const std::string HI_DEFAULTS ("*IDENTIFIED*:*PASSWORD*")
 default set of patterns used for history exclusion filter More...
 
void tee_write (FILE *file, const char *s, size_t slen, int flags)
 Write data to a stream. More...
 
void tee_fprintf (FILE *file, const char *fmt,...)
 
void tee_fputs (const char *s, FILE *file)
 
void tee_puts (const char *s, FILE *file)
 
void tee_putc (int c, FILE *file)
 
static void tee_print_sized_data (const char *, unsigned int, unsigned int, bool)
 
static int get_options (int argc, char **argv)
 
bool get_one_option (int optid, const struct my_option *opt, char *argument)
 
static int com_quit (String *str, char *)
 
static int com_go (String *str, char *)
 
static int com_ego (String *str, char *)
 
static int com_print (String *str, char *)
 
static int com_help (String *str, char *)
 
static int com_clear (String *str, char *)
 
static int com_connect (String *str, char *)
 
static int com_status (String *str, char *)
 
static int com_use (String *str, char *)
 
static int com_source (String *str, char *)
 
static int com_rehash (String *str, char *)
 
static int com_tee (String *str, char *)
 
static int com_notee (String *str, char *)
 
static int com_charset (String *str, char *)
 
static int com_prompt (String *str, char *)
 
static int com_delimiter (String *str, char *)
 
static int com_warnings (String *str, char *)
 
static int com_nowarnings (String *str, char *)
 
static int com_resetconnection (String *str, char *)
 
static int com_nopager (String *str, char *)
 
static int com_pager (String *str, char *)
 
static int com_edit (String *str, char *)
 
static int com_shell (String *str, char *)
 
static int read_and_execute (bool interactive)
 
static bool init_connection_options (MYSQL *mysql)
 
static int sql_connect (char *host, char *database, char *user, char *password, uint silent)
 
static const char * server_version_string (MYSQL *mysql)
 
static int put_info (const char *str, INFO_TYPE info, uint error=0, const char *sql_state=0)
 
static int put_error (MYSQL *mysql)
 
static void safe_put_field (const char *pos, ulong length)
 
static void xmlencode_print (const char *src, uint length)
 
static void init_pager ()
 
static void end_pager ()
 
static void init_tee (const char *)
 
static void end_tee ()
 
static const char * construct_prompt ()
 
static void reset_prompt (char *in_string, bool *ml_comment)
 
static char * get_arg (char *line, bool get_next_arg)
 
static void init_username ()
 
static void add_int_to_prompt (int toadd)
 
static int get_result_width (MYSQL_RES *result)
 For a new result, return the max number of characters that any upcoming row may return. More...
 
static int get_field_disp_length (MYSQL_FIELD *field)
 Return the length of a field after it would be rendered into text. More...
 
static int normalize_dbname (const char *line, char *buff, uint buff_size)
 Normalize database name. More...
 
static int get_quote_count (const char *line)
 
static void add_filtered_history (const char *string)
 
static void add_syslog (const char *buffer)
 
static void fix_line (String *buffer)
 
static void get_current_os_user ()
 
static void get_current_os_sudouser ()
 
int add_history (const char *command)
 
int read_history (const char *command)
 
int write_history (const char *command)
 
HIST_ENTRYhistory_get (int num)
 
static int not_in_history (const char *line)
 
static void initialize_readline (char *name)
 
static COMMANDSfind_command (char *name)
 It checks if the input is a long form command. More...
 
static COMMANDSfind_command (char cmd_char)
 It checks if the input is a short form command. More...
 
static bool add_line (String &buffer, char *line, size_t line_length, char *in_string, bool *ml_comment, bool truncated)
 
static void remove_cntrl (String &buffer)
 
static void print_table_data (MYSQL_RES *result)
 
static void print_table_data_html (MYSQL_RES *result)
 
static void print_table_data_xml (MYSQL_RES *result)
 
static void print_tab_data (MYSQL_RES *result)
 
static void print_table_data_vertically (MYSQL_RES *result)
 
static void print_warnings (void)
 
static ulong start_timer (void)
 
static void end_timer (ulong start_time, char *buff)
 
static void mysql_end_timer (ulong start_time, char *buff)
 
static void nice_time (double sec, char *buff, bool part_second)
 Write as many as 52+1 bytes to buff, in the form of a legible duration of time. More...
 
static void kill_query (const char *reason)
 
void mysql_end (int sig)
 
void handle_ctrlc_signal (int)
 SIGINT signal handler. More...
 
void handle_quit_signal (int sig)
 Handler to perform a cleanup and quit the program. More...
 
bool is_delimiter_command (char *name, ulong len)
 
int get_command_index (char cmd_char)
 Get the index of a command in the commands array. More...
 
int main (int argc, char *argv[])
 
static void usage (int version)
 
static char * new_command_generator (const char *text, int)
 
static char ** new_mysql_completion (const char *text, int start, int end)
 
char * no_completion ()
 
static int fake_magic_space (const char *, int)
 
static void build_completion_hash (bool rehash, bool write_info)
 
char * index (const char *, int c)
 
char * rindex (const char *, int)
 
static int reconnect (void)
 
static void get_current_db ()
 
static int mysql_real_query_for_lazy (const char *buf, size_t length)
 
static int mysql_store_result_for_lazy (MYSQL_RES **result)
 
static void print_help_item (MYSQL_ROW *cur, int num_name, int num_cat, char *last_char)
 
static int com_server_help (String *buffer, char *line, char *help_arg)
 
static const char * fieldtype2str (enum enum_field_types type)
 
static char * fieldflags2str (uint f)
 
static void print_field_types (MYSQL_RES *result)
 
static bool is_binary_field (MYSQL_FIELD *field)
 
static void print_as_hex (FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
 
static const char * array_value (const char **array, char key)
 
static int sql_real_connect (char *host, char *database, char *user, char *password, uint silent)
 

Variables

CHARSET_INFO my_charset_utf16le_bin
 
const char * VER = "14.14"
 
static char * server_version = NULL
 
static Pattern_matcher ignore_matcher
 used for matching which history lines to ignore More...
 
static HashTable ht
 
static MEM_ROOT argv_alloc {PSI_NOT_INSTRUMENTED, 512}
 
static MYSQL mysql
 
static bool ignore_errors = 0
 
static bool wait_flag = 0
 
static bool quick = 0
 
static bool connected = 0
 
static bool opt_raw_data = 0
 
static bool unbuffered = 0
 
static bool output_tables = 0
 
static bool opt_rehash = 1
 
static bool skip_updates = 0
 
static bool safe_updates = 0
 
static bool one_database = 0
 
static bool opt_compress = 0
 
static bool using_opt_local_infile = 0
 
static bool vertical = 0
 
static bool line_numbers = 1
 
static bool column_names = 1
 
static bool opt_html = 0
 
static bool opt_xml = 0
 
static bool opt_nopager = 1
 
static bool opt_outfile = 0
 
static bool named_cmds = 0
 
static bool tty_password = 0
 
static bool opt_nobeep = 0
 
static bool opt_reconnect = 1
 
static bool default_pager_set = 0
 
static bool opt_sigint_ignore = 0
 
static bool auto_vertical_output = 0
 
static bool show_warnings = 0
 
static bool executing_query = 0
 
static bool interrupted_query = 0
 
static bool ignore_spaces = 0
 
static bool sigint_received = 0
 
static bool opt_syslog = 0
 
static bool opt_binhex = 0
 
static bool debug_info_flag
 
static bool debug_check_flag
 
static bool column_types_flag
 
static bool preserve_comments = 0
 
static ulong opt_max_allowed_packet
 
static ulong opt_net_buffer_length
 
static uint verbose = 0
 
static uint opt_silent = 0
 
static uint opt_mysql_port = 0
 
static uint opt_local_infile = 0
 
static uint opt_enable_cleartext_plugin = 0
 
static bool using_opt_enable_cleartext_plugin = 0
 
static uint my_end_arg
 
static char * opt_mysql_unix_port = 0
 
static char * opt_bind_addr = NULL
 
static int connect_flag = CLIENT_INTERACTIVE
 
static bool opt_binary_mode = false
 
static bool opt_connect_expired_password = false
 
static char * current_host
 
static char * current_db
 
static char * current_user = 0
 
static char * opt_password = 0
 
static char * current_prompt = 0
 
static char * delimiter_str = 0
 
static char * default_charset = (char *)MYSQL_AUTODETECT_CHARSET_NAME
 
static char * opt_init_command = 0
 
static char * histfile
 
static char * histfile_tmp
 
static char * opt_histignore = NULL
 
static String glob_buffer
 
static String old_buffer
 
static String processed_prompt
 
static char * full_username = 0
 
static char * part_username = 0
 
static char * default_prompt = 0
 
static char * current_os_user = 0
 
static char * current_os_sudouser = 0
 
static int wait_time = 5
 
static STATUS status
 
static ulong select_limit
 
static ulong max_join_size
 
static ulong opt_connect_timeout = 0
 
static char mysql_charsets_dir [FN_REFLEN+1]
 
static char * opt_plugin_dir = 0
 
static char * opt_default_auth = 0
 
static const char * xmlmeta []
 
static const char * day_names []
 
static const char * month_names []
 
static char default_pager [FN_REFLEN]
 
static char pager [FN_REFLEN]
 
static char outfile [FN_REFLEN]
 
static FILE * PAGER
 
static FILE * OUTFILE
 
static MEM_ROOT hash_mem_root
 
static uint prompt_counter
 
static char delimiter [16] = DEFAULT_DELIMITER
 
static size_t delimiter_length = 1
 
unsigned short terminal_width = 80
 
static uint opt_protocol = 0
 
static const CHARSET_INFOcharset_info = &my_charset_latin1
 
const char * default_dbug_option = "d:t:o,/tmp/mysql.trace"
 
static bool opt_build_completion_hash = false
 
static COMMANDS commands []
 
static const char * load_default_groups [] = {"mysql", "client", 0}
 
int history_length
 
const char DELIMITER_NAME [] = "delimiter"
 
const uint DELIMITER_NAME_LEN = sizeof(DELIMITER_NAME) - 1
 
static int delimiter_index = -1
 
static int charset_index = -1
 
static bool real_binary_mode = false
 
static struct my_option my_long_options []
 

Macro Definition Documentation

◆ cmp_database

#define cmp_database (   cs,
  A,
 
)    strcmp((A), (B))

◆ DEFAULT_DELIMITER

#define DEFAULT_DELIMITER   ";"

◆ ff2s_check_flag

#define ff2s_check_flag (   X)
Value:
if (f & X##_FLAG) { \
s = my_stpcpy(s, #X " "); \
f &= ~X##_FLAG; \
}
static char * my_stpcpy(char *dst, const char *src)
Copy a string from src to dst until (and including) terminating null byte.
Definition: m_string.h:161
#define X
Definition: ctype-tis620.cc:75

◆ HAVE_READLINE

#define HAVE_READLINE

◆ MAX_ALLOCA_SIZE

#define MAX_ALLOCA_SIZE   512

◆ MAX_BATCH_BUFFER_SIZE

#define MAX_BATCH_BUFFER_SIZE   (1024L * 1024L * 1024L)

◆ MAX_COLUMN_LENGTH

#define MAX_COLUMN_LENGTH   1024

◆ MAX_SERVER_ARGS

#define MAX_SERVER_ARGS   64

◆ MY_PRINT_CTRL

#define MY_PRINT_CTRL   16 /* Replace TAB, NL, CR to "\t", "\n", "\r" */

◆ MY_PRINT_ESC_0

#define MY_PRINT_ESC_0   1 /* Replace 0x00 bytes to "\0" */

◆ MY_PRINT_MB

#define MY_PRINT_MB   8 /* Recognize multi-byte characters */

◆ MY_PRINT_SPS_0

#define MY_PRINT_SPS_0   2 /* Replace 0x00 bytes to space */

◆ MY_PRINT_XML

#define MY_PRINT_XML   4 /* Encode XML entities */

◆ PROMPT_CHAR

#define PROMPT_CHAR   '\\'

◆ USE_POPEN

#define USE_POPEN

Typedef Documentation

◆ HIST_ENTRY

typedef struct _hist_entry HIST_ENTRY

◆ INFO_TYPE

typedef enum enum_info_type INFO_TYPE

Enumeration Type Documentation

◆ enum_info_type

Enumerator
INFO_INFO 
INFO_ERROR 
INFO_RESULT 

Function Documentation

◆ add_filtered_history()

static void add_filtered_history ( const char *  string)
static

◆ add_history()

int add_history ( const char *  command)

◆ add_int_to_prompt()

static void add_int_to_prompt ( int  toadd)
static

◆ add_line()

static bool add_line ( String buffer,
char *  line,
size_t  line_length,
char *  in_string,
bool ml_comment,
bool  truncated 
)
static

◆ add_syslog()

void add_syslog ( const char *  buffer)
static

◆ array_value()

static const char* array_value ( const char **  array,
char  key 
)
static

◆ build_completion_hash()

static void build_completion_hash ( bool  rehash,
bool  write_info 
)
static

◆ com_charset()

static int com_charset ( String str,
char *  line 
)

◆ com_clear()

static int com_clear ( String str,
char *  line 
)

◆ com_connect()

static int com_connect ( String str,
char *  line 
)

◆ com_delimiter()

static int com_delimiter ( String str,
char *  line 
)

◆ com_edit()

static int com_edit ( String str,
char *  line 
)

◆ com_ego()

static int com_ego ( String str,
char *  line 
)

◆ com_go()

static int com_go ( String str,
char *  line 
)

◆ com_help()

static int com_help ( String str,
char *  line 
)

◆ com_nopager()

static int com_nopager ( String str,
char *  line 
)
static

◆ com_notee()

static int com_notee ( String str,
char *  line 
)

◆ com_nowarnings()

static int com_nowarnings ( String str,
char *  line 
)

◆ com_pager()

static int com_pager ( String str,
char *  line 
)

◆ com_print()

static int com_print ( String str,
char *  line 
)

◆ com_prompt()

static int com_prompt ( String str,
char *  line 
)

◆ com_quit()

static int com_quit ( String str,
char *  line 
)
static

◆ com_rehash()

static int com_rehash ( String str,
char *  line 
)

◆ com_resetconnection()

static int com_resetconnection ( String str,
char *  line 
)

◆ com_server_help()

static int com_server_help ( String buffer,
char *  line,
char *  help_arg 
)
static

◆ com_shell()

static int com_shell ( String str,
char *  line 
)

◆ com_source()

static int com_source ( String str,
char *  line 
)

◆ com_status()

static int com_status ( String str,
char *  line 
)

◆ com_tee()

static int com_tee ( String str,
char *  line 
)

◆ com_use()

static int com_use ( String str,
char *  line 
)

◆ com_warnings()

static int com_warnings ( String str,
char *  line 
)

◆ construct_prompt()

static const char * construct_prompt ( )
static

◆ end_pager()

static void end_pager ( )
static

◆ end_tee()

static void end_tee ( )
static

◆ end_timer()

static void end_timer ( ulong  start_time,
char *  buff 
)
static

◆ fake_magic_space()

static int fake_magic_space ( const char *  ,
int   
)
static

◆ fieldflags2str()

static char* fieldflags2str ( uint  f)
static

◆ fieldtype2str()

static const char* fieldtype2str ( enum enum_field_types  type)
static

◆ find_command() [1/2]

static COMMANDS * find_command ( char *  name)
static

It checks if the input is a long form command.

It returns the command's pointer if a command is found, else return NULL. Note that if binary-mode is set, then only DELIMITER is searched for.

Parameters
nameA string.
Returns
the command's pointer or NULL.

◆ find_command() [2/2]

static COMMANDS * find_command ( char  cmd_char)
static

It checks if the input is a short form command.

It returns the command's pointer if a command is found, else return NULL. Note that if binary-mode is set, then only \C is searched for.

Parameters
cmd_charA character of one byte.
Returns
the command's pointer or NULL.

◆ fix_line()

static void fix_line ( String buffer)
static

◆ get_arg()

char * get_arg ( char *  line,
bool  get_next_arg 
)
static

◆ get_command_index()

int get_command_index ( char  cmd_char)
inline

Get the index of a command in the commands array.

Parameters
cmd_charShort form command.
Returns
int The index of the command is returned if it is found, else -1 is returned.

◆ get_current_db()

static void get_current_db ( )
static

◆ get_current_os_sudouser()

static void get_current_os_sudouser ( )
static

◆ get_current_os_user()

static void get_current_os_user ( )
static

◆ get_field_disp_length()

static int get_field_disp_length ( MYSQL_FIELD field)
static

Return the length of a field after it would be rendered into text.

This doesn't know or care about multibyte characters. Assume we're using such a charset. We can't know that all of the upcoming rows for this column will have bytes that each render into some fraction of a character. It's at least possible that a row has bytes that all render into one character each, and so the maximum length is still the number of bytes. (Assumption 1: This can't be better because we can never know the number of characters that the DB is going to send – only the number of bytes. 2: Chars <= Bytes.)

Parameters
fieldPointer to a field to be inspected
Returns
number of character positions to be used, at most

◆ get_one_option()

static bool get_one_option ( int  optid,
const struct my_option opt,
char *  argument 
)

◆ get_options()

static int get_options ( int  argc,
char **  argv 
)
static

◆ get_quote_count()

static int get_quote_count ( const char *  line)
static

◆ get_result_width()

static int get_result_width ( MYSQL_RES result)
static

For a new result, return the max number of characters that any upcoming row may return.

Parameters
resultPointer to the result to judge
Returns
The max number of characters in any row of this result

◆ handle_ctrlc_signal()

void handle_ctrlc_signal ( int  )

SIGINT signal handler.

This function handles SIGINT (Ctrl - C). It sends a 'KILL [QUERY]' command to the server if a query is currently executing. On Windows, 'Ctrl - Break' is treated alike.

◆ handle_quit_signal()

void handle_quit_signal ( int  sig)

Handler to perform a cleanup and quit the program.

This function would send a 'KILL [QUERY]' command to the server if a query is currently executing and then it invokes mysql_thread_end()/ mysql_end() in order to terminate the mysql client process.

Parameters
sigSignal number

◆ HI_DEFAULTS()

static const std::string HI_DEFAULTS ( "*IDENTIFIED*:*PASSWORD*"  )
static

default set of patterns used for history exclusion filter

◆ history_get()

HIST_ENTRY* history_get ( int  num)

◆ index()

char * index ( const char *  s,
int  c 
)

◆ init_connection_options()

static bool init_connection_options ( MYSQL mysql)
static

◆ init_pager()

static void init_pager ( )
static

◆ init_tee()

static void init_tee ( const char *  file_name)
static

◆ init_username()

static void init_username ( )
static

◆ initialize_readline()

static void initialize_readline ( char *  name)
static

◆ is_binary_field()

static bool is_binary_field ( MYSQL_FIELD field)
static

◆ is_delimiter_command()

bool is_delimiter_command ( char *  name,
ulong  len 
)
inline

◆ kill_query()

static void kill_query ( const char *  reason)
static

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ mysql_end()

void mysql_end ( int  sig)

◆ mysql_end_timer()

static void mysql_end_timer ( ulong  start_time,
char *  buff 
)
static

◆ mysql_real_query_for_lazy()

static int mysql_real_query_for_lazy ( const char *  buf,
size_t  length 
)
static

◆ mysql_store_result_for_lazy()

static int mysql_store_result_for_lazy ( MYSQL_RES **  result)
static

◆ new_command_generator()

static char * new_command_generator ( const char *  text,
int  state 
)
static

◆ new_mysql_completion()

static char ** new_mysql_completion ( const char *  text,
int  start,
int  end 
)
static

◆ nice_time()

static void nice_time ( double  sec,
char *  buff,
bool  part_second 
)
static

Write as many as 52+1 bytes to buff, in the form of a legible duration of time.

len("4294967296 days, 23 hours, 59 minutes, 60.00 seconds") -> 52

◆ no_completion()

char* no_completion ( )

◆ normalize_dbname()

static int normalize_dbname ( const char *  line,
char *  buff,
uint  buff_size 
)
static

Normalize database name.

Parameters
[in]lineThe command.
[out]buffNormalized db name.
[in]buff_sizeBuffer size.
Returns
Operation status
Return values
0Success
1Failure
Note
Sometimes server normalizes the database names & APIs like mysql_select_db() expect normalized database names. Since it is difficult to perform the name conversion/normalization on the client side, this function tries to get the normalized dbname (indirectly) from the server.

◆ not_in_history()

static int not_in_history ( const char *  line)
static

◆ print_as_hex()

static void print_as_hex ( FILE *  output_file,
const char *  str,
ulong  len,
ulong  total_bytes_to_send 
)
static

◆ print_field_types()

static void print_field_types ( MYSQL_RES result)
static

◆ print_help_item()

static void print_help_item ( MYSQL_ROW cur,
int  num_name,
int  num_cat,
char *  last_char 
)
static

◆ print_tab_data()

static void print_tab_data ( MYSQL_RES result)
static

◆ print_table_data()

static void print_table_data ( MYSQL_RES result)
static

◆ print_table_data_html()

static void print_table_data_html ( MYSQL_RES result)
static

◆ print_table_data_vertically()

static void print_table_data_vertically ( MYSQL_RES result)
static

◆ print_table_data_xml()

static void print_table_data_xml ( MYSQL_RES result)
static

◆ print_warnings()

static void print_warnings ( void  )
static

◆ put_error()

static int put_error ( MYSQL mysql)
static

◆ put_info()

static int put_info ( const char *  str,
INFO_TYPE  info,
uint  error = 0,
const char *  sql_state = 0 
)
static

◆ read_and_execute()

static int read_and_execute ( bool  interactive)
static

◆ read_history()

int read_history ( const char *  command)

◆ reconnect()

static int reconnect ( void  )
static

◆ remove_cntrl()

static void remove_cntrl ( String buffer)
static

◆ reset_prompt()

static void reset_prompt ( char *  in_string,
bool ml_comment 
)
inlinestatic

◆ rindex()

char * rindex ( const char *  s,
int  c 
)

◆ safe_put_field()

static void safe_put_field ( const char *  pos,
ulong  length 
)
static

◆ server_version_string()

static const char * server_version_string ( MYSQL mysql)
static

◆ sql_connect()

static int sql_connect ( char *  host,
char *  database,
char *  user,
char *  password,
uint  silent 
)
static

◆ sql_real_connect()

static int sql_real_connect ( char *  host,
char *  database,
char *  user,
char *  password,
uint  silent 
)
static

◆ start_timer()

static ulong start_timer ( void  )
static

◆ tee_fprintf()

void tee_fprintf ( FILE *  file,
const char *  fmt,
  ... 
)

◆ tee_fputs()

void tee_fputs ( const char *  s,
FILE *  file 
)

◆ tee_print_sized_data()

static void tee_print_sized_data ( const char *  data,
unsigned int  data_length,
unsigned int  total_bytes_to_send,
bool  right_justified 
)
static

◆ tee_putc()

void tee_putc ( int  c,
FILE *  file 
)

◆ tee_puts()

void tee_puts ( const char *  s,
FILE *  file 
)

◆ tee_write()

void tee_write ( FILE *  file,
const char *  s,
size_t  slen,
int  flags 
)

Write data to a stream.

Various modes, corresponding to –tab, –xml, –raw parameters, are supported.

Parameters
fileStream to write to
sString to write
slenString length
flagsFlags for –tab, –xml, –raw.

◆ usage()

static void usage ( int  version)
static

◆ write_history()

int write_history ( const char *  command)

◆ xmlencode_print()

static void xmlencode_print ( const char *  src,
uint  length 
)
static

Variable Documentation

◆ argv_alloc

MEM_ROOT argv_alloc {PSI_NOT_INSTRUMENTED, 512}
static

◆ auto_vertical_output

bool auto_vertical_output = 0
static

◆ charset_index

int charset_index = -1
static

◆ charset_info

const CHARSET_INFO* charset_info = &my_charset_latin1
static

◆ column_names

bool column_names = 1
static

◆ column_types_flag

bool column_types_flag
static

◆ commands

COMMANDS commands[]
static

◆ connect_flag

int connect_flag = CLIENT_INTERACTIVE
static

◆ connected

bool connected = 0
static

◆ current_db

char * current_db
static

◆ current_host

char* current_host
static

◆ current_os_sudouser

char * current_os_sudouser = 0
static

◆ current_os_user

char* current_os_user = 0
static

◆ current_prompt

char * current_prompt = 0
static

◆ current_user

char * current_user = 0
static

◆ day_names

const char* day_names[]
static
Initial value:
= {"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"}

◆ debug_check_flag

bool debug_check_flag
static

◆ debug_info_flag

bool debug_info_flag
static

◆ default_charset

char * default_charset = (char *)MYSQL_AUTODETECT_CHARSET_NAME
static

◆ default_dbug_option

const char* default_dbug_option = "d:t:o,/tmp/mysql.trace"

◆ default_pager

char default_pager[FN_REFLEN]
static

◆ default_pager_set

bool default_pager_set = 0
static

◆ default_prompt

char * default_prompt = 0
static

◆ delimiter

char delimiter[16] = DEFAULT_DELIMITER
static

◆ delimiter_index

int delimiter_index = -1
static

◆ delimiter_length

size_t delimiter_length = 1
static

◆ DELIMITER_NAME

const char DELIMITER_NAME[] = "delimiter"

◆ DELIMITER_NAME_LEN

const uint DELIMITER_NAME_LEN = sizeof(DELIMITER_NAME) - 1

◆ delimiter_str

char * delimiter_str = 0
static

◆ executing_query

bool executing_query = 0
static

◆ full_username

char* full_username = 0
static

◆ glob_buffer

String glob_buffer
static

◆ hash_mem_root

MEM_ROOT hash_mem_root
static

◆ histfile

char* histfile
static

◆ histfile_tmp

char* histfile_tmp
static

◆ history_length

int history_length

◆ ht

HashTable ht
static

◆ ignore_errors

bool ignore_errors = 0
static

◆ ignore_matcher

Pattern_matcher ignore_matcher
static

used for matching which history lines to ignore

◆ ignore_spaces

bool ignore_spaces = 0
static

◆ interrupted_query

bool interrupted_query = 0
static

◆ line_numbers

bool line_numbers = 1
static

◆ load_default_groups

const char* load_default_groups[] = {"mysql", "client", 0}
static

◆ max_join_size

ulong max_join_size
static

◆ month_names

const char* month_names[]
static
Initial value:
= {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}

◆ my_charset_utf16le_bin

CHARSET_INFO my_charset_utf16le_bin

◆ my_end_arg

uint my_end_arg
static

◆ my_long_options

struct my_option my_long_options[]
static

◆ mysql

MYSQL mysql
static

◆ mysql_charsets_dir

char mysql_charsets_dir[FN_REFLEN+1]
static

◆ named_cmds

bool named_cmds = 0
static

◆ old_buffer

String old_buffer
static

◆ one_database

bool one_database = 0
static

◆ opt_binary_mode

bool opt_binary_mode = false
static

◆ opt_bind_addr

char* opt_bind_addr = NULL
static

◆ opt_binhex

bool opt_binhex = 0
static

◆ opt_build_completion_hash

bool opt_build_completion_hash = false
static

◆ opt_compress

bool opt_compress = 0
static

◆ opt_connect_expired_password

bool opt_connect_expired_password = false
static

◆ opt_connect_timeout

ulong opt_connect_timeout = 0
static

◆ opt_default_auth

char * opt_default_auth = 0
static

◆ opt_enable_cleartext_plugin

uint opt_enable_cleartext_plugin = 0
static

◆ opt_histignore

char* opt_histignore = NULL
static

◆ opt_html

bool opt_html = 0
static

◆ opt_init_command

char * opt_init_command = 0
static

◆ opt_local_infile

uint opt_local_infile = 0
static

◆ opt_max_allowed_packet

ulong opt_max_allowed_packet
static

◆ opt_mysql_port

uint opt_mysql_port = 0
static

◆ opt_mysql_unix_port

char* opt_mysql_unix_port = 0
static

◆ opt_net_buffer_length

ulong opt_net_buffer_length
static

◆ opt_nobeep

bool opt_nobeep = 0
static

◆ opt_nopager

bool opt_nopager = 1
static

◆ opt_outfile

bool opt_outfile = 0
static

◆ opt_password

char * opt_password = 0
static

◆ opt_plugin_dir

char* opt_plugin_dir = 0
static

◆ opt_protocol

uint opt_protocol = 0
static

◆ opt_raw_data

bool opt_raw_data = 0
static

◆ opt_reconnect

bool opt_reconnect = 1
static

◆ opt_rehash

bool opt_rehash = 1
static

◆ opt_sigint_ignore

bool opt_sigint_ignore = 0
static

◆ opt_silent

uint opt_silent = 0
static

◆ opt_syslog

bool opt_syslog = 0
static

◆ opt_xml

bool opt_xml = 0
static

◆ outfile

char outfile[FN_REFLEN]
static

◆ OUTFILE

FILE * OUTFILE
static

◆ output_tables

bool output_tables = 0
static

◆ pager

char pager[FN_REFLEN]
static

◆ PAGER

FILE* PAGER
static

◆ part_username

char * part_username = 0
static

◆ preserve_comments

bool preserve_comments = 0
static

◆ processed_prompt

String processed_prompt
static

◆ prompt_counter

uint prompt_counter
static

◆ quick

bool quick = 0
static

◆ real_binary_mode

bool real_binary_mode = false
static

◆ safe_updates

bool safe_updates = 0
static

◆ select_limit

ulong select_limit
static

◆ server_version

char* server_version = NULL
static

◆ show_warnings

bool show_warnings = 0
static

◆ sigint_received

bool sigint_received = 0
static

◆ skip_updates

bool skip_updates = 0
static

◆ status

STATUS status
static

◆ terminal_width

unsigned short terminal_width = 80

◆ tty_password

bool tty_password = 0
static

◆ unbuffered

bool unbuffered = 0
static

◆ using_opt_enable_cleartext_plugin

bool using_opt_enable_cleartext_plugin = 0
static

◆ using_opt_local_infile

bool using_opt_local_infile = 0
static

◆ VER

const char* VER = "14.14"

◆ verbose

uint verbose = 0
static

◆ vertical

bool vertical = 0
static

◆ wait_flag

bool wait_flag = 0
static

◆ wait_time

int wait_time = 5
static

◆ xmlmeta

const char* xmlmeta[]
static
Initial value:
= {
"&", "&amp;", "<", "&lt;", ">", "&gt;", "\"", "&quot;",
"\0", " ", 0, 0}