1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-30 11:22:14 +03:00

Merge station.:/mnt/raid/alik/MySQL/devel/5.1

into  station.:/mnt/raid/alik/MySQL/devel/5.1-rt
This commit is contained in:
anozdrin/alik@station.
2007-12-13 12:06:37 +03:00
54 changed files with 1118 additions and 551 deletions

View File

@@ -1662,7 +1662,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
!dont_log_query);
if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) &&
(if_exists || table_type == NULL))
{
error= 0;
thd->clear_error();
}
if (error == HA_ERR_ROW_IS_REFERENCED)
{
/* the table is referenced by a foreign key constraint */
@@ -4201,18 +4204,22 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
(table->table->file->ha_check_for_upgrade(check_opt) ==
HA_ADMIN_NEEDS_ALTER))
{
my_bool save_no_send_ok= thd->net.no_send_ok;
DBUG_PRINT("admin", ("recreating table"));
ha_autocommit_or_rollback(thd, 1);
close_thread_tables(thd);
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
thd->net.no_send_ok= TRUE;
result_code= mysql_recreate_table(thd, table);
thd->net.no_send_ok= save_no_send_ok;
reenable_binlog(thd);
/*
mysql_recreate_table() can push OK or ERROR.
Clear 'OK' status. If there is an error, keep it:
we will store the error message in a result set row
and then clear.
*/
if (thd->main_da.is_ok())
thd->main_da.reset_diagnostics_area();
goto send_result;
}
}
DBUG_PRINT("admin", ("calling operator_func '%s'", operator_name));
@@ -4306,7 +4313,6 @@ send_result_message:
case HA_ADMIN_TRY_ALTER:
{
my_bool save_no_send_ok= thd->net.no_send_ok;
/*
This is currently used only by InnoDB. ha_innobase::optimize() answers
"try with alter", so here we close the table, do an ALTER TABLE,
@@ -4318,10 +4324,16 @@ send_result_message:
*save_next_global= table->next_global;
table->next_local= table->next_global= 0;
tmp_disable_binlog(thd); // binlogging is done by caller if wanted
thd->net.no_send_ok= TRUE;
result_code= mysql_recreate_table(thd, table);
thd->net.no_send_ok= save_no_send_ok;
reenable_binlog(thd);
/*
mysql_recreate_table() can push OK or ERROR.
Clear 'OK' status. If there is an error, keep it:
we will store the error message in a result set row
and then clear.
*/
if (thd->main_da.is_ok())
thd->main_da.reset_diagnostics_area();
ha_autocommit_or_rollback(thd, 0);
close_thread_tables(thd);
if (!result_code) // recreation went ok
@@ -4332,9 +4344,10 @@ send_result_message:
}
if (result_code) // either mysql_recreate_table or analyze failed
{
const char *err_msg;
if ((err_msg= thd->net.last_error))
DBUG_ASSERT(thd->is_error());
if (thd->is_error())
{
const char *err_msg= thd->main_da.message();
if (!thd->vio_ok())
{
sql_print_error(err_msg);
@@ -4350,6 +4363,7 @@ send_result_message:
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
}
thd->clear_error();
}
}
result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;