summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 0fdd0da2399..5cdb86a6f4c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2203,12 +2203,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
if ((table->table->db_stat & HA_READ_ONLY) && open_for_modify)
{
char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
+ uint length;
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
protocol->store("error", 5, system_charset_info);
- my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY), table_name);
- protocol->store(buff, system_charset_info);
+ length= my_snprintf(buff, sizeof(buff), ER(ER_OPEN_AS_READONLY),
+ table_name);
+ protocol->store(buff, length, system_charset_info);
close_thread_tables(thd);
table->table=0; // For query cache
if (protocol->write())
@@ -2239,6 +2241,17 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
open_for_modify= 0;
}
+ if (table->table->s->crashed && operator_func == &handler::check)
+ {
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store(operator_name, system_charset_info);
+ protocol->store("warning", 7, system_charset_info);
+ protocol->store("Table is marked as crashed", 26, system_charset_info);
+ if (protocol->write())
+ goto err;
+ }
+
result_code = (table->table->file->*operator_func)(thd, check_opt);
send_result: