diff options
Diffstat (limited to 'client/mysqlcheck.c')
-rw-r--r-- | client/mysqlcheck.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 42c4cae5621..aaf77dbb743 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -543,7 +543,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) { int view; char *table; - uint table_len; + size_t table_len; DBUG_ENTER("process_selected_tables"); if (use_db(db)) @@ -587,6 +587,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) my_free(table_names_comma_sep); } else + { for (; tables > 0; tables--, table_names++) { table= *table_names; @@ -596,6 +597,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) continue; handle_request_for_tables(table, table_len, view == 1, opt_all_in_1); } + } DBUG_RETURN(0); } /* process_selected_tables */ @@ -669,7 +671,7 @@ static int process_all_tables_in_db(char *database) size_t tot_length = 0; char *views, *views_end; - uint tot_views_length = 0; + size_t tot_views_length = 0; while ((row = mysql_fetch_row(res))) { @@ -915,16 +917,29 @@ static int handle_request_for_tables(char *tables, size_t length, } break; case DO_ANALYZE: + if (view) + { + printf("%-50s %s\n", tables, "Can't run anaylyze on a view"); + DBUG_RETURN(1); + } DBUG_ASSERT(!view); op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG"; if (opt_persistent_all) end = strmov(end, " PERSISTENT FOR ALL"); break; case DO_OPTIMIZE: - DBUG_ASSERT(!view); + if (view) + { + printf("%-50s %s\n", tables, "Can't run optimize on a view"); + DBUG_RETURN(1); + } op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG"; break; case DO_FIX_NAMES: - DBUG_ASSERT(!view); + if (view) + { + printf("%-50s %s\n", tables, "Can't run fix names on a view"); + DBUG_RETURN(1); + } DBUG_RETURN(fix_table_storage_name(tables)); } @@ -953,7 +968,7 @@ static int handle_request_for_tables(char *tables, size_t length, } if (verbose >= 3) puts(query); - if (mysql_real_query(sock, query, query_length)) + if (mysql_real_query(sock, query, (ulong)query_length)) { my_snprintf(message, sizeof(message), "when executing '%s%s... %s'", op, tab_view, options); @@ -965,7 +980,7 @@ static int handle_request_for_tables(char *tables, size_t length, if (opt_flush_tables) { query_length= sprintf(query, "FLUSH TABLES %s", table_name); - if (mysql_real_query(sock, query, query_length)) + if (mysql_real_query(sock, query, (ulong)query_length)) { DBerror(sock, query); my_free(query); |