diff options
author | monty@hundin.mysql.fi <> | 2001-12-06 01:05:30 +0200 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-12-06 01:05:30 +0200 |
commit | 4c17825acd56ccbbf7e6649e7ebe98c34f992c84 (patch) | |
tree | b6eaff9c9c574324b7a2aae18f5de2e52f89576c /sql/sql_table.cc | |
parent | 40da50460543ee76d70b727506bf0676be9bcd52 (diff) | |
download | mariadb-git-4c17825acd56ccbbf7e6649e7ebe98c34f992c84.tar.gz |
Update of query cache code
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 737c8fccd9d..2f9fa17faf1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -951,6 +951,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, sprintf(buff, ER(ER_OPEN_AS_READONLY), table_name); net_store_data(packet, buff); close_thread_tables(thd); + table->table=0; // For query cache if (my_net_write(&thd->net, (char*) thd->packet.ptr(), packet->length())) goto err; @@ -1028,6 +1029,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, remove_table_from_cache(thd, table->table->table_cache_key, table->table->real_name); close_thread_tables(thd); + table->table=0; // For query cache if (my_net_write(&thd->net, (char*) packet->ptr(), packet->length())) goto err; @@ -1037,9 +1039,12 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables, DBUG_RETURN(0); err: close_thread_tables(thd); // Shouldn't be needed + if (table) + table->table=0; DBUG_RETURN(-1); } + int mysql_backup_table(THD* thd, TABLE_LIST* table_list) { DBUG_ENTER("mysql_backup_table"); @@ -1658,24 +1663,30 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } if (error) { - // This shouldn't happen. We solve this the safe way by - // closing the locked table. + /* + This shouldn't happen. We solve this the safe way by + closing the locked table. + */ close_cached_table(thd,table); VOID(pthread_mutex_unlock(&LOCK_open)); goto err; } if (thd->lock || new_name != table_name) // True if WIN32 { - // Not table locking or alter table with rename - // free locks and remove old table + /* + Not table locking or alter table with rename + free locks and remove old table + */ close_cached_table(thd,table); VOID(quick_rm_table(old_db_type,db,old_name)); } else { - // Using LOCK TABLES without rename. - // This code is never executed on WIN32! - // Remove old renamed table, reopen table and get new locks + /* + Using LOCK TABLES without rename. + This code is never executed on WIN32! + Remove old renamed table, reopen table and get new locks + */ if (table) { VOID(table->file->extra(HA_EXTRA_FORCE_REOPEN)); // Use new file @@ -1712,7 +1723,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, } VOID(pthread_cond_broadcast(&COND_refresh)); VOID(pthread_mutex_unlock(&LOCK_open)); - table_list->table=0; // Table is closed + table_list->table=0; // For query cache query_cache.invalidate(table_list); end_temporary: |