summaryrefslogtreecommitdiff
path: root/sql/sql_handler.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2006-01-06 10:42:58 -0800
committerunknown <jimw@mysql.com>2006-01-06 10:42:58 -0800
commit91881b44c347e173d5d49aa9e5351a42267ed0a2 (patch)
tree8924a87e95e1f01b8788892513110b379c98c991 /sql/sql_handler.cc
parent3c4c332fd0ce4f6ec06a1f3b0c98a25cac80a2f4 (diff)
parentbf1ebe98dfe51c7f7b13e783cd13d8362a26afbf (diff)
downloadmariadb-git-91881b44c347e173d5d49aa9e5351a42267ed0a2.tar.gz
Merge mysql.com:/home/jimw/my/mysql-5.0-clean
into mysql.com:/home/jimw/my/mysql-5.1-clean include/config-win.h: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/bdb.test: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/disabled.def: Auto merged mysql-test/t/view.test: Auto merged sql/ha_federated.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/parse_file.cc: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_trigger.cc: Auto merged sql/field.cc: Resolve conflict sql/ha_ndbcluster.cc: Resolve conflict sql/log_event.cc: Resolve conflict
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r--sql/sql_handler.cc37
1 files changed, 8 insertions, 29 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc
index 6418f844dbe..f1bbf6f0f5e 100644
--- a/sql/sql_handler.cc
+++ b/sql/sql_handler.cc
@@ -227,6 +227,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
/* add to hash */
if (my_hash_insert(&thd->handler_tables_hash, (byte*) hash_tables))
{
+ my_free((char*) hash_tables, MYF(0));
mysql_ha_close(thd, tables);
goto err;
}
@@ -369,28 +370,6 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
hash_tables->db, hash_tables->table_name,
hash_tables->alias, table));
- /* Table might have been flushed. */
- if (table && (table->s->version != refresh_version))
- {
- /*
- We must follow the thd->handler_tables chain, as we need the
- address of the 'next' pointer referencing this table
- for close_thread_table().
- */
- for (table_ptr= &(thd->handler_tables);
- *table_ptr && (*table_ptr != table);
- table_ptr= &(*table_ptr)->next)
- {}
- (*table_ptr)->file->ha_index_or_rnd_end();
- VOID(pthread_mutex_lock(&LOCK_open));
- if (close_thread_table(thd, table_ptr))
- {
- /* Tell threads waiting for refresh that something has happened */
- VOID(pthread_cond_broadcast(&COND_refresh));
- }
- VOID(pthread_mutex_unlock(&LOCK_open));
- table= hash_tables->table= NULL;
- }
if (!table)
{
/*
@@ -436,6 +415,13 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
}
tables->table=table;
+ HANDLER_TABLES_HACK(thd);
+ lock= mysql_lock_tables(thd, &tables->table, 1, 0, &not_used);
+ HANDLER_TABLES_HACK(thd);
+
+ if (!lock)
+ goto err0; // mysql_lock_tables() printed error message already
+
if (cond && ((!cond->fixed &&
cond->fix_fields(thd, &cond)) || cond->check_cols(1)))
goto err0;
@@ -455,13 +441,6 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
protocol->send_fields(&list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
- HANDLER_TABLES_HACK(thd);
- lock= mysql_lock_tables(thd, &tables->table, 1, 0, &not_used);
- HANDLER_TABLES_HACK(thd);
-
- if (!lock)
- goto err0; // mysql_lock_tables() printed error message already
-
/*
In ::external_lock InnoDB resets the fields which tell it that
the handle is used in the HANDLER interface. Tell it again that