diff options
author | unknown <bell@laptop.sanja.is.com.ua> | 2003-08-19 20:14:35 +0300 |
---|---|---|
committer | unknown <bell@laptop.sanja.is.com.ua> | 2003-08-19 20:14:35 +0300 |
commit | 6d0a048701e07e69dea899fc1a6caa8f5d6b435d (patch) | |
tree | 095650183fd0ccdaa33b61c73f3a08954efac80b /sql/sql_table.cc | |
parent | 3808546d8a67d62420f9111998d94e44050ac313 (diff) | |
parent | 513917a53f87ce43dea98838a7d4e6196b9ea82b (diff) | |
download | mariadb-git-6d0a048701e07e69dea899fc1a6caa8f5d6b435d.tar.gz |
merge
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/subselect.test:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.h:
Auto merged
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 99865001317..37f8d0d7f4f 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -760,6 +760,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, sql_field->flags|= NOT_NULL_FLAG; sql_field->pack_flag&= ~FIELDFLAG_MAYBE_NULL; } + else + key_info->flags|= HA_NULL_PART_KEY; if (!(file->table_flags() & HA_NULL_KEY)) { my_printf_error(ER_NULL_COLUMN_IN_INDEX,ER(ER_NULL_COLUMN_IN_INDEX), @@ -771,7 +773,6 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, my_error(ER_SPATIAL_CANT_HAVE_NULL, MYF(0)); DBUG_RETURN(-1); } - key_info->flags|= HA_NULL_PART_KEY; } if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER) { @@ -1087,7 +1088,8 @@ mysql_rename_table(enum db_type base, wait_while_table_is_used() thd Thread handler table Table to remove from cache - + function HA_EXTRA_PREPARE_FOR_DELETE if table is to be deleted + HA_EXTRA_FORCE_REOPEN if table is not be used NOTES When returning, the table will be unusable for other threads until the table is closed. @@ -1097,13 +1099,14 @@ mysql_rename_table(enum db_type base, Win32 clients must also have a WRITE LOCK on the table ! */ -static void wait_while_table_is_used(THD *thd,TABLE *table) +static void wait_while_table_is_used(THD *thd,TABLE *table, + enum ha_extra_function function) { DBUG_PRINT("enter",("table: %s", table->real_name)); DBUG_ENTER("wait_while_table_is_used"); safe_mutex_assert_owner(&LOCK_open); - VOID(table->file->extra(HA_EXTRA_FORCE_REOPEN)); // Close all data files + VOID(table->file->extra(function)); /* Mark all tables that are in use as 'old' */ mysql_lock_abort(thd, table); // end threads waiting on lock @@ -1139,7 +1142,7 @@ static bool close_cached_table(THD *thd, TABLE *table) { DBUG_ENTER("close_cached_table"); - wait_while_table_is_used(thd,table); + wait_while_table_is_used(thd, table, HA_EXTRA_PREPARE_FOR_DELETE); /* Close lock if this is not got with LOCK TABLES */ if (thd->lock) { @@ -1365,6 +1368,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, if (protocol->send_fields(&field_list, 1)) DBUG_RETURN(-1); + mysql_ha_closeall(thd, tables); for (table = tables; table; table = table->next) { char table_name[NAME_LEN*2+2]; @@ -1851,7 +1855,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, break; case ENABLE: VOID(pthread_mutex_lock(&LOCK_open)); - wait_while_table_is_used(thd, table); + 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() */ @@ -1860,7 +1864,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, if (table->db_type == DB_TYPE_MYISAM) { VOID(pthread_mutex_lock(&LOCK_open)); - wait_while_table_is_used(thd, table); + 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); } |