diff options
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 60e0939491c..83c5838f739 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -144,7 +144,7 @@ static unsigned long connect_flags= CLIENT_MULTI_RESULTS | CLIENT_MULTI_STATEMENTS | CLIENT_REMEMBER_OPTIONS; -static int verbose, delimiter_length; +static int verbose; static uint commit_rate; static uint detach_rate; const char *num_int_cols_opt; @@ -263,7 +263,7 @@ void option_cleanup(option_string *stmt); void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr); static int run_statements(MYSQL *mysql, statement *stmt); int slap_connect(MYSQL *mysql); -static int run_query(MYSQL *mysql, const char *query, int len); +static int run_query(MYSQL *mysql, const char *query, size_t len); static const char ALPHANUMERICS[]= "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz"; @@ -343,9 +343,6 @@ int main(int argc, char **argv) if (auto_generate_sql) srandom((uint)time(NULL)); - /* globals? Yes, so we only have to run strlen once */ - delimiter_length= strlen(delimiter); - if (argc > 2) { fprintf(stderr,"%s: Too many arguments\n",my_progname); @@ -779,8 +776,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, - opt->name); + if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, + opt->name)) <= 0) + { + sf_leaking_memory= 1; /* no memory leak reports here */ + exit(1); + } break; case '#': DBUG_PUSH(argument ? argument : default_dbug_option); @@ -1548,18 +1549,18 @@ get_options(int *argc,char ***argv) } -static int run_query(MYSQL *mysql, const char *query, int len) +static int run_query(MYSQL *mysql, const char *query, size_t len) { if (opt_only_print) { - printf("%.*s;\n", len, query); + printf("%.*s;\n", (int)len, query); return 0; } if (verbose >= 3) - printf("%.*s;\n", len, query); + printf("%.*s;\n", (int)len, query); - return mysql_real_query(mysql, query, len); + return mysql_real_query(mysql, query, (ulong)len); } @@ -2127,7 +2128,7 @@ parse_delimiter(const char *script, statement **stmt, char delm) char *ptr= (char *)script; statement **sptr= stmt; statement *tmp; - uint length= strlen(script); + size_t length= strlen(script); uint count= 0; /* We know that there is always one */ for (tmp= *sptr= (statement *)my_malloc(sizeof(statement), |