diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-10-09 17:12:26 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-10-09 17:12:26 +0200 |
commit | cfeedbfd3e292f61c7da8f0a7f86307cbeeddb64 (patch) | |
tree | 3629d1de148b14915a35a21f809e1a2ea6a08619 /sql/sql_handler.cc | |
parent | bff1af983ad7b0bed6c3973e4d13297df5fe2791 (diff) | |
parent | 16c4b3c68b06653592a9500050ad977a38f4ebae (diff) | |
download | mariadb-git-cfeedbfd3e292f61c7da8f0a7f86307cbeeddb64.tar.gz |
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql/sql_handler.cc')
-rw-r--r-- | sql/sql_handler.cc | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 110bca96530..c2d4c32ab71 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2001, 2013, Oracle and/or its affiliates. - Copyright (c) 2011, 2013, Monty Program Ab. +/* Copyright (c) 2001, 2015, Oracle and/or its affiliates. + Copyright (c) 2011, 2015, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1190,3 +1190,36 @@ void mysql_ha_set_explicit_lock_duration(THD *thd) DBUG_VOID_RETURN; } + +/** + Remove temporary tables from the HANDLER's hash table. The reason + for having a separate function, rather than calling + mysql_ha_rm_tables() is that it is not always feasible (e.g. in + close_temporary_tables) to obtain a TABLE_LIST containing the + temporary tables. + + @See close_temporary_tables + @param thd Thread identifier. +*/ +void mysql_ha_rm_temporary_tables(THD *thd) +{ + DBUG_ENTER("mysql_ha_rm_temporary_tables"); + + TABLE_LIST *tmp_handler_tables= NULL; + for (uint i= 0; i < thd->handler_tables_hash.records; i++) + { + TABLE_LIST *handler_table= reinterpret_cast<TABLE_LIST*> + (my_hash_element(&thd->handler_tables_hash, i)); + + if (handler_table->table && handler_table->table->s->tmp_table) + { + handler_table->next_local= tmp_handler_tables; + tmp_handler_tables= handler_table; + } + } + + if (tmp_handler_tables) + mysql_ha_rm_tables(thd, tmp_handler_tables); + + DBUG_VOID_RETURN; +} |