diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2013-09-17 18:51:14 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2013-09-17 18:51:14 +0400 |
commit | 45d3ada7c2f81227bb0b8b219b787f4d9746ca21 (patch) | |
tree | 6e89b9b8d110b7f3bf15fb4412cd4de76093c9e8 /client/mysqlslap.c | |
parent | e2d1aaec8232168ca03252be07bbb0c705b70397 (diff) | |
download | mariadb-git-45d3ada7c2f81227bb0b8b219b787f4d9746ca21.tar.gz |
MDEV-4684 - Enhancement request: --init-command support for mysqlslap
Added --init-command argument to mysqlslap: SQL Command to execute
when connecting to MySQL server. Will automatically be re-executed
when reconnecting.
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 8e70a2609c3..202fcf7950f 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -123,7 +123,8 @@ static char *host= NULL, *opt_password= NULL, *user= NULL, *default_engine= NULL, *pre_system= NULL, *post_system= NULL, - *opt_mysql_unix_port= NULL; + *opt_mysql_unix_port= NULL, + *opt_init_command= NULL; static char *opt_plugin_dir= 0, *opt_default_auth= 0; const char *delimiter= "\n"; @@ -629,6 +630,11 @@ static struct my_option my_long_options[] = GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, REQUIRED_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.", + &opt_init_command, &opt_init_command, 0, + GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"iterations", 'i', "Number of times to run the tests.", &iterations, &iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0}, {"no-drop", OPT_SLAP_NO_DROP, "Do not drop the schema after the test.", @@ -2241,6 +2247,8 @@ slap_connect(MYSQL *mysql) for (x= 0; x < 10; x++) { set_mysql_connect_options(mysql); + if (opt_init_command) + mysql_options(mysql, MYSQL_INIT_COMMAND, opt_init_command); if (mysql_real_connect(mysql, host, user, opt_password, create_schema_string, opt_mysql_port, |