diff options
author | unknown <holyfoot@deer.(none)> | 2006-02-17 10:52:32 +0400 |
---|---|---|
committer | unknown <holyfoot@deer.(none)> | 2006-02-17 10:52:32 +0400 |
commit | 437afc71235b9cab8b7e801e1473818e8604e6ff (patch) | |
tree | e1075b7c3e3c1d0a91edf078cf69906180661d4c /sql/sql_table.cc | |
parent | f504554358d1ef9e46d5e9902b2a22399bc9e14a (diff) | |
download | mariadb-git-437afc71235b9cab8b7e801e1473818e8604e6ff.tar.gz |
WL#2645 (CHECK TABLE FOR UPGRADE)
necessary implementation in the server
mysql_upgrade script added
client/mysqlcheck.c:
--check-upgrade option added
include/my_base.h:
errcode added
include/myisam.h:
option added
scripts/Makefile.am:
mysql_upgrade script added
sql/handler.cc:
checks for old types/bugs added
sql/handler.h:
declarations regarding checks for upgrade
sql/lex.h:
sym added
sql/share/errmsg.txt:
error message added
sql/slave.cc:
now ha_repair is for public use
sql/sql_table.cc:
upgrade in ha_repair implemented
sql/sql_yacc.yy:
CHECK ... FOR UPGRADE added to syntax
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b1a24543a6b..e48ca8636ae 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)); } |