summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mysql.com>2009-10-21 15:48:22 +0500
committerAlexander Barkov <bar@mysql.com>2009-10-21 15:48:22 +0500
commitdcb8bb23c29172949781f5214b8222505752de70 (patch)
treed2522e7182d47f0be16e18e95d3830f7ff496ce0 /client
parent52701ff3277d6641994e6b76d84bb5903af48d59 (diff)
parentde7d1abe9386c2e9df1a8c5f3b95f3cd57cc6c9f (diff)
downloadmariadb-git-dcb8bb23c29172949781f5214b8222505752de70.tar.gz
Merging mysql-next-mr-merge to mysql-next-mr.
Diffstat (limited to 'client')
-rw-r--r--client/client_priv.h1
-rw-r--r--client/mysql.cc9
2 files changed, 9 insertions, 1 deletions
diff --git a/client/client_priv.h b/client/client_priv.h
index 06145232995..e99d34ffa97 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -80,5 +80,6 @@ enum options_client
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
OPT_WRITE_BINLOG, OPT_DUMP_DATE,
+ OPT_INIT_COMMAND,
OPT_MAX_CLIENT_OPTION
};
diff --git a/client/mysql.cc b/client/mysql.cc
index d46f18332ab..6c0c6771ba1 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -155,7 +155,8 @@ static char * opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0,
- *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
+ *default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME,
+ *opt_init_command= 0;
static char *histfile;
static char *histfile_tmp;
static String glob_buffer,old_buffer;
@@ -1384,6 +1385,10 @@ static struct my_option my_long_options[] =
{"ignore-spaces", 'i', "Ignore space after function names.",
(uchar**) &ignore_spaces, (uchar**) &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
+ {"init-command", OPT_INIT_COMMAND,
+ "SQL Command to execute when connecting to MySQL server. Will automatically be re-executed when reconnecting.",
+ (uchar**) &opt_init_command, (uchar**) &opt_init_command, 0,
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
(uchar**) &opt_local_infile,
(uchar**) &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
@@ -4203,6 +4208,8 @@ sql_real_connect(char *host,char *database,char *user,char *password,
mysql_close(&mysql);
}
mysql_init(&mysql);
+ if (opt_init_command)
+ mysql_options(&mysql, MYSQL_INIT_COMMAND, opt_init_command);
if (opt_connect_timeout)
{
uint timeout=opt_connect_timeout;