summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-02-08 09:44:41 +0000
committerunknown <serg@serg.mysql.com>2002-02-08 09:44:41 +0000
commit6259917372b2980a5302f50b62fd6e549827b2c5 (patch)
treea789ce87aac1d6fbd5410457a9d599be1fdf2151
parent49266c90a2cf581df6158561f01d64129523d537 (diff)
parent94611b9de8d68af21c4e20e7d4a739856ae4f5d7 (diff)
downloadmariadb-git-6259917372b2980a5302f50b62fd6e549827b2c5.tar.gz
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
-rw-r--r--sql/sql_table.cc32
1 files changed, 17 insertions, 15 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 14daf8c1924..0335c6f49cf 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -911,6 +911,11 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table)
"Failed generating table from .frm file"));
}
}
+
+ // now we should be able to open the partially restored table
+ // to finish the restore in the handler later on
+ if (!(table->table = reopen_name_locked_table(thd, table)))
+ unlock_table_name(thd, table);
DBUG_RETURN(0);
}
@@ -919,8 +924,9 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT* check_opt,
const char *operator_name,
thr_lock_type lock_type,
- bool open_for_modify, bool restore,
+ bool open_for_modify,
uint extra_open_options,
+ int (*prepare_func)(THD *, TABLE_LIST *),
int (handler::*operator_func)
(THD *, HA_CHECK_OPT *))
{
@@ -952,18 +958,13 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
table->table = open_ltable(thd, table, lock_type);
thd->open_options&= ~extra_open_options;
packet->length(0);
- if (restore)
+ if (prepare_func)
{
- switch (prepare_for_restore(thd, table)) {
- case 1: continue; // error, message written to net
- case -1: goto err; // error, message could be written to net
- default: ;// should be 0 otherwise
+ switch ((*prepare_func)(thd, table)) {
+ case 1: continue; // error, message written to net
+ case -1: goto err; // error, message could be written to net
+ default: ; // should be 0 otherwise
}
-
- // now we should be able to open the partially restored table
- // to finish the restore in the handler later on
- if (!(table->table = reopen_name_locked_table(thd, table)))
- unlock_table_name(thd, table);
}
if (!table->table)
@@ -1096,7 +1097,8 @@ int mysql_restore_table(THD* thd, TABLE_LIST* table_list)
{
DBUG_ENTER("mysql_restore_table");
DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
- "restore", TL_WRITE, 1, 1,0,
+ "restore", TL_WRITE, 1, 0,
+ &prepare_for_restore,
&handler::restore));
}
@@ -1104,7 +1106,7 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{
DBUG_ENTER("mysql_repair_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
- "repair", TL_WRITE, 1, 0, HA_OPEN_FOR_REPAIR,
+ "repair", TL_WRITE, 1, HA_OPEN_FOR_REPAIR, 0,
&handler::repair));
}
@@ -1143,7 +1145,7 @@ int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
DBUG_ENTER("mysql_check_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
"check", lock_type,
- 0, 0, HA_OPEN_FOR_REPAIR,
+ 0, HA_OPEN_FOR_REPAIR, 0,
&handler::check));
}
@@ -1157,7 +1159,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
ORDER *order,
bool drop_primary,
enum enum_duplicates handle_duplicates,
- enum enum_enable_or_disable keys_onoff,
+ enum enum_enable_or_disable keys_onoff,
bool simple_alter)
{
TABLE *table,*new_table;