summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <holyfoot@mysql.com>2006-02-17 10:56:54 +0400
committerunknown <holyfoot@mysql.com>2006-02-17 10:56:54 +0400
commit05cf4e43d8c02193ad639ac6f8cb8f1daff7f414 (patch)
tree101ed8c3ff614f46e9bf5be42eaa6cc6a6566ed0 /sql/sql_table.cc
parent067cbaf8a1f0bab5081ad7e08baa674c5949ff6b (diff)
parent437afc71235b9cab8b7e801e1473818e8604e6ff (diff)
downloadmariadb-git-05cf4e43d8c02193ad639ac6f8cb8f1daff7f414.tar.gz
Merge bk@192.168.21.1:mysql-5.0
into mysql.com:/home/hf/work/mysql-5.0.w2645 sql/sql_table.cc: Auto merged
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc34
1 files changed, 31 insertions, 3 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 3c6ca618107..de350b83985 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2328,7 +2328,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
open_for_modify= 0;
}
- if (table->table->s->crashed && operator_func == &handler::check)
+ if (table->table->s->crashed && operator_func == &handler::ha_check)
{
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
@@ -2340,6 +2340,21 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
goto err;
}
+ if (operator_func == &handler::ha_repair)
+ {
+ if ((table->table->file->check_old_types() == HA_ADMIN_NEEDS_ALTER) ||
+ (table->table->file->ha_check_for_upgrade(check_opt) ==
+ HA_ADMIN_NEEDS_ALTER))
+ {
+ close_thread_tables(thd);
+ tmp_disable_binlog(thd); // binlogging is done by caller if wanted
+ result_code= mysql_recreate_table(thd, table, 0);
+ reenable_binlog(thd);
+ goto send_result;
+ }
+
+ }
+
result_code = (table->table->file->*operator_func)(thd, check_opt);
send_result:
@@ -2466,6 +2481,19 @@ send_result_message:
break;
}
+ case HA_ADMIN_NEEDS_UPGRADE:
+ case HA_ADMIN_NEEDS_ALTER:
+ {
+ char buf[ERRMSGSIZE];
+ uint length;
+
+ protocol->store(STRING_WITH_LEN("error"), system_charset_info);
+ length=my_snprintf(buf, ERRMSGSIZE, ER(ER_TABLE_NEEDS_UPGRADE), table->table_name);
+ protocol->store(buf, length, system_charset_info);
+ fatal_error=1;
+ break;
+ }
+
default: // Probably HA_ADMIN_INTERNAL_ERROR
{
char buf[ERRMSGSIZE+20];
@@ -2535,7 +2563,7 @@ bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
test(check_opt->sql_flags & TT_USEFRM),
HA_OPEN_FOR_REPAIR,
&prepare_for_repair,
- &handler::repair, 0));
+ &handler::ha_repair, 0));
}
@@ -2847,7 +2875,7 @@ bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
"check", lock_type,
0, HA_OPEN_FOR_REPAIR, 0, 0,
- &handler::check, &view_checksum));
+ &handler::ha_check, &view_checksum));
}