summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2006-01-05 00:38:51 +0300
committerunknown <konstantin@mysql.com>2006-01-05 00:38:51 +0300
commit0b47dbfcdfccff7dd8a9eba2e39c32677bc3a642 (patch)
tree640ca9d3de9d7d3d7a25fc3b4c5affabfdee1487 /sql/sql_base.cc
parentbd88ee1aac8f45797dcd90802b1917b568982c3e (diff)
parent7bf8a9e6cafbaaf3ee71724a29bbd3880a30fea6 (diff)
downloadmariadb-git-0b47dbfcdfccff7dd8a9eba2e39c32677bc3a642.tar.gz
Merge mysql.com:/opt/local/work/mysql-5.0-merge
into mysql.com:/opt/local/work/mysql-5.1-merge include/config-win.h: Auto merged mysys/hash.c: Auto merged mysql-test/r/rpl_stm_sp.result: Auto merged mysql-test/t/rpl_stm_sp.test: Auto merged sql/ha_innodb.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_show.cc: Auto merged storage/ndb/src/kernel/blocks/dbtup/DbtupCommit.cpp: Auto merged mysql-test/r/information_schema.result: Manual merge. mysql-test/t/information_schema.test: Manual merge. sql/lock.cc: Manual merge.
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c1fad0a9bbf..74a5848fa0a 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1702,6 +1702,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
char key[MAX_DBKEY_LENGTH];
uint key_length;
char *alias= table_list->alias;
+ HASH_SEARCH_STATE state;
DBUG_ENTER("open_table");
/* find a unused table in the open table cache */
@@ -1862,9 +1863,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
if (thd->handler_tables)
mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
- for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
+ for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length,
+ &state);
table && table->in_use ;
- table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length))
+ table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length,
+ &state))
{
if (table->s->version != refresh_version)
{
@@ -2240,10 +2243,12 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock)
uint key_length= table->s->table_cache_key.length;
DBUG_PRINT("loop", ("table_name: %s", table->alias));
- for (TABLE *search=(TABLE*) hash_search(&open_cache,
- (byte*) key,key_length) ;
+ HASH_SEARCH_STATE state;
+ for (TABLE *search= (TABLE*) hash_first(&open_cache, (byte*) key,
+ key_length, &state);
search ;
- search = (TABLE*) hash_next(&open_cache,(byte*) key,key_length))
+ search= (TABLE*) hash_next(&open_cache, (byte*) key,
+ key_length, &state))
{
DBUG_PRINT("info", ("share: 0x%lx locked_by_flush: %d "
"locked_by_name: %d db_stat: %u version: %u",
@@ -5848,11 +5853,14 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
for (;;)
{
+ HASH_SEARCH_STATE state;
result= signalled= 0;
- for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
+ for (table= (TABLE*) hash_first(&open_cache, (byte*) key, key_length,
+ &state);
table;
- table = (TABLE*) hash_next(&open_cache,(byte*) key,key_length))
+ table= (TABLE*) hash_next(&open_cache, (byte*) key, key_length,
+ &state))
{
THD *in_use;
table->s->version=0L; /* Free when thread is ready */