summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-04-07 17:14:38 +0200
committerunknown <serg@serg.mylan>2004-04-07 17:14:38 +0200
commit3c8ae8905240b0779c8e80f6957ba85fcb6e0e7a (patch)
tree125d29dae27c75767bc2f87c1b5191de4bf3aa06 /sql/sql_table.cc
parent1bfdb17777c91105233e605211e464e8d3a588ed (diff)
parentb6f2a534fe9cfa4b67afa2ea8ad8c65f043d6302 (diff)
downloadmariadb-git-3c8ae8905240b0779c8e80f6957ba85fcb6e0e7a.tar.gz
merged
sql/handler.h: Auto merged sql/sql_base.cc: Auto merged
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc58
1 files changed, 30 insertions, 28 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 40160020545..17ea4cd540e 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2612,28 +2612,28 @@ int real_alter_table(THD *thd,char *new_db, char *new_name,
case LEAVE_AS_IS:
break;
case ENABLE:
- VOID(pthread_mutex_lock(&LOCK_open));
- wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
- VOID(pthread_mutex_unlock(&LOCK_open));
- error= table->file->activate_all_index(thd);
- /* COND_refresh will be signaled in close_thread_tables() */
- break;
+ VOID(pthread_mutex_lock(&LOCK_open));
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ error= table->file->enable_indexes();
+ /* COND_refresh will be signaled in close_thread_tables() */
+ break;
case DISABLE:
- if (table->db_type == DB_TYPE_MYISAM)
- {
- VOID(pthread_mutex_lock(&LOCK_open));
- wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
- VOID(pthread_mutex_unlock(&LOCK_open));
- table->file->deactivate_non_unique_index(HA_POS_ERROR);
- /* COND_refresh will be signaled in close_thread_tables() */
- }
- else
- push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_ILLEGAL_HA,
- ER(ER_ILLEGAL_HA), table->table_name);
- break;
+ VOID(pthread_mutex_lock(&LOCK_open));
+ wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN);
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ error=table->file->disable_indexes(0, 1);
+ /* COND_refresh will be signaled in close_thread_tables() */
+ break;
}
}
+ if (error==HA_ERR_WRONG_COMMAND)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA),
+ table->table_name);
+ error=0;
+ }
if (!error)
{
mysql_update_log.write(thd, thd->query, thd->query_length);
@@ -2645,6 +2645,11 @@ int real_alter_table(THD *thd,char *new_db, char *new_name,
}
send_ok(thd);
}
+ else
+ {
+ table->file->print_error(error, MYF(0));
+ error=-1;
+ }
table_list->table=0; // For query cache
query_cache_invalidate3(thd, table_list, 0);
DBUG_RETURN(error);
@@ -3236,9 +3241,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
DBUG_RETURN(-1); /* purecov: inspected */
to->file->external_lock(thd,F_WRLCK);
- to->file->extra(HA_EXTRA_WRITE_CACHE);
from->file->info(HA_STATUS_VARIABLE);
- to->file->deactivate_non_unique_index(from->file->records);
+ to->file->start_bulk_insert(from->file->records);
List_iterator<create_field> it(create);
create_field *def;
@@ -3321,17 +3325,15 @@ copy_data_between_tables(TABLE *from,TABLE *to,
end_read_record(&info);
free_io_cache(from);
delete [] copy; // This is never 0
- uint tmp_error;
- if ((tmp_error=to->file->extra(HA_EXTRA_NO_CACHE)))
+
+ if (to->file->end_bulk_insert() && !error)
{
- to->file->print_error(tmp_error,MYF(0));
+ to->file->print_error(my_errno,MYF(0));
error=1;
}
to->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
- if (to->file->activate_all_index(thd))
- error=1;
- tmp_error = ha_recovery_logging(thd,TRUE);
+ ha_recovery_logging(thd,TRUE);
/*
Ensure that the new table is saved properly to disk so that we
can do a rename
@@ -3421,7 +3423,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
if (f->type() == FIELD_TYPE_BLOB)
{
String tmp;
- f->val_str(&tmp,&tmp);
+ f->val_str(&tmp);
row_crc= my_checksum(row_crc, (byte*) tmp.ptr(), tmp.length());
}
else