diff options
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index dc0c876e882..30ffa3703c2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4304,73 +4304,6 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table, return 1; } - -static int prepare_for_restore(THD* thd, TABLE_LIST* table, - HA_CHECK_OPT *check_opt) -{ - DBUG_ENTER("prepare_for_restore"); - - if (table->table) // do not overwrite existing tables on restore - { - DBUG_RETURN(send_check_errmsg(thd, table, "restore", - "table exists, will not overwrite on restore" - )); - } - else - { - char* backup_dir= thd->lex->backup_dir; - char src_path[FN_REFLEN], dst_path[FN_REFLEN + 1], uname[FN_REFLEN]; - char* table_name= table->table_name; - char* db= table->db; - - tablename_to_filename(table->table_name, uname, sizeof(uname) - 1); - - if (fn_format_relative_to_data_home(src_path, uname, backup_dir, reg_ext)) - DBUG_RETURN(-1); // protect buffer overflow - - build_table_filename(dst_path, sizeof(dst_path) - 1, - db, table_name, reg_ext, 0); - - if (lock_and_wait_for_table_name(thd,table)) - DBUG_RETURN(-1); - - if (my_copy(src_path, dst_path, MYF(MY_WME))) - { - pthread_mutex_lock(&LOCK_open); - unlock_table_name(thd, table); - pthread_mutex_unlock(&LOCK_open); - DBUG_RETURN(send_check_errmsg(thd, table, "restore", - "Failed copying .frm file")); - } - if (mysql_truncate(thd, table, 1)) - { - pthread_mutex_lock(&LOCK_open); - unlock_table_name(thd, table); - pthread_mutex_unlock(&LOCK_open); - DBUG_RETURN(send_check_errmsg(thd, table, "restore", - "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 - */ - pthread_mutex_lock(&LOCK_open); - if (reopen_name_locked_table(thd, table, TRUE)) - { - unlock_table_name(thd, table); - pthread_mutex_unlock(&LOCK_open); - DBUG_RETURN(send_check_errmsg(thd, table, "restore", - "Failed to open partially restored table")); - } - /* A MERGE table must not come here. */ - DBUG_ASSERT(!table->table || !table->table->child_l); - pthread_mutex_unlock(&LOCK_open); - DBUG_RETURN(0); -} - - static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, HA_CHECK_OPT *check_opt) { @@ -5037,29 +4970,6 @@ err: } -bool mysql_backup_table(THD* thd, TABLE_LIST* table_list) -{ - DBUG_ENTER("mysql_backup_table"); - WARN_DEPRECATED(thd, "6.0", "BACKUP TABLE", - "MySQL Administrator (mysqldump, mysql)"); - DBUG_RETURN(mysql_admin_table(thd, table_list, 0, - "backup", TL_READ, 0, 0, 0, 0, - &handler::ha_backup, 0)); -} - - -bool mysql_restore_table(THD* thd, TABLE_LIST* table_list) -{ - DBUG_ENTER("mysql_restore_table"); - WARN_DEPRECATED(thd, "6.0", "RESTORE TABLE", - "MySQL Administrator (mysqldump, mysql)"); - DBUG_RETURN(mysql_admin_table(thd, table_list, 0, - "restore", TL_WRITE, 1, 1, 0, - &prepare_for_restore, - &handler::ha_restore, 0)); -} - - bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) { DBUG_ENTER("mysql_repair_table"); |