summaryrefslogtreecommitdiff
path: root/client/mysqlslap.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r--client/mysqlslap.c10
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,