diff options
Diffstat (limited to 'client/mysqlcheck.c')
-rw-r--r-- | client/mysqlcheck.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 3350bfa17a7..ce0eceeb907 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -512,14 +512,17 @@ static int process_all_tables_in_db(char *database) { MYSQL_RES *res; MYSQL_ROW row; + uint num_columns; LINT_INIT(res); if (use_db(database)) return 1; - if (mysql_query(sock, "SHOW TABLE STATUS") || + if (mysql_query(sock, "SHOW /*!50002 FULL*/ TABLES") || !((res= mysql_store_result(sock)))) return 1; + num_columns= mysql_num_fields(res); + if (opt_all_in_1) { /* @@ -542,12 +545,11 @@ static int process_all_tables_in_db(char *database) } for (end = tables + 1; (row = mysql_fetch_row(res)) ;) { - /* Skip tables with an engine of NULL (probably a view). */ - if (row[1]) - { - end= fix_table_name(end, row[0]); - *end++= ','; - } + if ((num_columns == 2) && (strcmp(row[1], "VIEW") == 0)) + continue; + + end= fix_table_name(end, row[0]); + *end++= ','; } *--end = 0; if (tot_length) @@ -557,14 +559,13 @@ static int process_all_tables_in_db(char *database) else { while ((row = mysql_fetch_row(res))) - /* - Skip tables with an engine of NULL (probably a view) - if we don't perform renaming. - */ - if (row[1] || what_to_do == DO_UPGRADE) - { - handle_request_for_tables(row[0], fixed_name_length(row[0])); - } + { + /* Skip views if we don't perform renaming. */ + if ((what_to_do != DO_UPGRADE) && (num_columns == 2) && (strcmp(row[1], "VIEW") == 0)) + continue; + + handle_request_for_tables(row[0], fixed_name_length(row[0])); + } } mysql_free_result(res); return 0; |