summaryrefslogtreecommitdiff
path: root/client/mysqlslap.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-05-03 19:10:10 +0300
committerMichael Widenius <monty@askmonty.org>2011-05-03 19:10:10 +0300
commit1be5462d59fa5fbd1ca92286c3a0a049c00f4bb9 (patch)
tree17ba1ed90233efa64bc83364ed1ffb74dd637ead /client/mysqlslap.c
parentce55d37929fc91b476541d3a77336a44b20317ac (diff)
parent90e058e0c623f770ee602ebab86e91303f08c90a (diff)
downloadmariadb-git-1be5462d59fa5fbd1ca92286c3a0a049c00f4bb9.tar.gz
Merge with MariaDB 5.1
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r--client/mysqlslap.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 8a45b567e84..c38380c7306 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,
@@ -617,6 +617,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,
@@ -1167,8 +1169,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))
@@ -1541,7 +1546,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 :) */
@@ -1915,17 +1925,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++;