diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-02 20:58:45 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-02 20:58:45 +0300 |
commit | e415ba0fb2c57eaf370e84a3a9c8d831f820a560 (patch) | |
tree | f113a8024de4ee4f1bc19aae98c19a2835f5b4e7 /client/mysqlslap.c | |
parent | 046418ad956c98c3788d79650fcb50479844df3b (diff) | |
parent | a1f7ceb281f9d87c9baea125ebab26f99a0370f8 (diff) | |
download | mariadb-git-e415ba0fb2c57eaf370e84a3a9c8d831f820a560.tar.gz |
Merge with MySQL 5.1.57/58
Moved some BSD string functions from Unireg
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 0b3ea2a0065..1f4bc4aa9d9 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -131,7 +131,7 @@ const char *delimiter= "\n"; const char *create_schema_string= "mysqlslap"; -static my_bool opt_preserve= TRUE; +static my_bool opt_preserve= TRUE, opt_no_drop= FALSE; static my_bool debug_info_flag= 0, debug_check_flag= 0; static my_bool opt_only_print= FALSE; static my_bool opt_compress= FALSE, tty_password= FALSE, @@ -616,6 +616,8 @@ static struct my_option my_long_options[] = 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.", + &opt_no_drop, &opt_no_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"number-char-cols", 'x', "Number of VARCHAR columns to create in table if specifying --auto-generate-sql.", (char**) &num_char_cols_opt, (char**) &num_char_cols_opt, 0, GET_STR, REQUIRED_ARG, @@ -1166,8 +1168,11 @@ get_options(int *argc,char ***argv) if (!user) user= (char *)"root"; - /* If something is created we clean it up, otherwise we leave schemas alone */ - if (create_string || auto_generate_sql) + /* + If something is created and --no-drop is not specified, we drop the + schema. + */ + if (!opt_no_drop && (create_string || auto_generate_sql)) opt_preserve= FALSE; if (auto_generate_sql && (create_string || user_supplied_query)) @@ -1540,7 +1545,12 @@ generate_primary_key_list(MYSQL *mysql, option_string *engine_stmt) exit(1); } - result= mysql_store_result(mysql); + if (!(result= mysql_store_result(mysql))) + { + fprintf(stderr, "%s: Error when storing result: %d %s\n", + my_progname, mysql_errno(mysql), mysql_error(mysql)); + exit(1); + } primary_keys_number_of= mysql_num_rows(result); /* So why check this? Blackhole :) */ @@ -1914,17 +1924,15 @@ limit_not_met: { if (mysql_field_count(mysql)) { - if ((result= mysql_store_result(mysql))) + if (!(result= mysql_store_result(mysql))) + fprintf(stderr, "%s: Error when storing result: %d %s\n", + my_progname, mysql_errno(mysql), mysql_error(mysql)); + else { - while ((row = mysql_fetch_row(result))) + while ((row= mysql_fetch_row(result))) counter++; mysql_free_result(result); } - else - { - fprintf(stderr,"%s: Error in mysql_store_result(): %d %s\n", - my_progname, mysql_errno(mysql), mysql_error(mysql)); - } } } while(mysql_next_result(mysql) == 0); queries++; |