mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #16502: mysqlcheck gets confused with views
Make mysqlcheck skip over views when processing all of the tables in a database. client/mysqlcheck.c: Use SHOW TABLE STATUS to get table list, and skip over things that don't have an engine (like a VIEW). mysql-test/r/mysqlcheck.result: Add new results mysql-test/t/mysqlcheck.test: Add new regression test
This commit is contained in:
@ -458,7 +458,7 @@ static int process_all_tables_in_db(char *database)
|
||||
LINT_INIT(res);
|
||||
if (use_db(database))
|
||||
return 1;
|
||||
if (mysql_query(sock, "SHOW TABLES") ||
|
||||
if (mysql_query(sock, "SHOW TABLE STATUS") ||
|
||||
!((res= mysql_store_result(sock))))
|
||||
return 1;
|
||||
|
||||
@ -484,8 +484,12 @@ static int process_all_tables_in_db(char *database)
|
||||
}
|
||||
for (end = tables + 1; (row = mysql_fetch_row(res)) ;)
|
||||
{
|
||||
end= fix_table_name(end, row[0]);
|
||||
*end++= ',';
|
||||
/* Skip tables with an engine of NULL (probably a view). */
|
||||
if (row[1])
|
||||
{
|
||||
end= fix_table_name(end, row[0]);
|
||||
*end++= ',';
|
||||
}
|
||||
}
|
||||
*--end = 0;
|
||||
if (tot_length)
|
||||
@ -495,7 +499,11 @@ static int process_all_tables_in_db(char *database)
|
||||
else
|
||||
{
|
||||
while ((row = mysql_fetch_row(res)))
|
||||
handle_request_for_tables(row[0], strlen(row[0]));
|
||||
/* Skip tables with an engine of NULL (probably a view). */
|
||||
if (row[1])
|
||||
{
|
||||
handle_request_for_tables(row[0], strlen(row[0]));
|
||||
}
|
||||
}
|
||||
mysql_free_result(res);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user