MySQL 8.4.3
Source Code Documentation
|
#include <fcntl.h>
#include <mysql.h>
#include <mysqld_error.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <string>
#include "client/include/client_priv.h"
#include "compression.h"
#include "m_string.h"
#include "my_alloc.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_thread.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql/strings/int2str.h"
#include "mysql/strings/m_ctype.h"
#include "nulls.h"
#include "print_version.h"
#include "sql_common.h"
#include "str2int.h"
#include "strxmov.h"
#include "typelib.h"
#include "welcome_copyright_notice.h"
#include "client/include/sslopt-vars.h"
#include "client/include/caching_sha2_passwordopt-vars.h"
#include "client/include/multi_factor_passwordopt-vars.h"
#include "client/include/multi_factor_passwordopt-longopts.h"
#include "client/include/sslopt-longopts.h"
#include "client/include/caching_sha2_passwordopt-longopts.h"
#include "client/include/sslopt-case.h"
Macros | |
#define | MAX_MYSQL_VAR 8192 |
#define | SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ |
#define | MAX_TRUNC_LENGTH 3 |
#define | FIRST_SOURCE_COMMAND_VERSION 80200 |
Functions | |
static void | usage (void) |
bool | get_one_option (int optid, const struct my_option *opt, char *argument) |
static bool | sql_connect (MYSQL *mysql, uint wait) |
connect to server, optionally waiting for same to come up More... | |
static int | execute_commands (MYSQL *mysql, int argc, char **argv) |
Execute all commands. More... | |
static char ** | mask_password (int argc, char ***argv) |
Masking the password if it is passed as command line argument. More... | |
static int | drop_db (MYSQL *mysql, const char *db) |
void | endprog (int signal_number) |
static void | nice_time (ulong sec, char *buff) |
static void | print_header (MYSQL_RES *result) |
static void | print_top (MYSQL_RES *result) |
static void | print_row (MYSQL_RES *result, MYSQL_ROW cur, uint row) |
static void | print_relative_row (MYSQL_RES *result, MYSQL_ROW cur, uint row) |
static void | print_relative_row_vert (MYSQL_RES *result, MYSQL_ROW cur, uint row) |
static void | print_relative_header () |
static void | print_relative_line () |
static void | truncate_names () |
static bool | get_pidfile (MYSQL *mysql, char *pidfile) |
static bool | wait_pidfile (char *pidfile, time_t last_modified, struct stat *pidfile_status) |
static void | store_values (MYSQL_RES *result) |
static void | print_warnings (MYSQL *mysql) |
int | main (int argc, char *argv[]) |
#define FIRST_SOURCE_COMMAND_VERSION 80200 |
#define MAX_MYSQL_VAR 8192 |
#define MAX_TRUNC_LENGTH 3 |
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ |
enum commands |
|
static |
static void endprog | ( | int | signal_number | ) |
|
static |
Execute all commands.
We try to execute all commands we were given, in the order given, but return with non-zero as soon as we encounter trouble. By that token, individual commands can be considered a conjunction with boolean short-cut.
0 | Yes! ALL commands worked! |
1 | No, one failed and will never work (malformed): fatal error! |
-1 | No, one failed on the server, may work next time! |
bool get_one_option | ( | int | optid, |
const struct my_option * | opt, | ||
char * | argument | ||
) |
|
static |
int main | ( | int | argc, |
char * | argv[] | ||
) |
|
static |
Masking the password if it is passed as command line argument.
It works in Linux and changes cmdline in ps and /proc/pid/cmdline, but it won't work for history file of shell. The command line arguments are copied to another array and the password in the argv is masked. This function is called just after "handle_options" because in "handle_options", the agrv pointers are altered which makes freeing of dynamically allocated memory difficult. The password masking is done before all other operations in order to minimise the time frame of password visibility via cmdline.
argc | command line options (count) |
argv | command line options (values) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
connect to server, optionally waiting for same to come up
mysql | connection struct |
wait | wait for server to come up? (0: no, ~0: forever, n: cycles) |
0 | success |
1 | failure |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
const char* default_charset = MYSQL_AUTODETECT_CHARSET_NAME |
|
static |
|
static |
|
static |
|
static |
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN] |
const char* host = nullptr |
|
static |
|
static |
ulonglong last_values[MAX_MYSQL_VAR] |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH] |
|
static |
char* user = nullptr |
|
static |