summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc87
1 files changed, 0 insertions, 87 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3a04c14dee9..770975f79fe 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -630,93 +630,6 @@ err:
}
-/**
- Close all tables which match specified connection string or
- if specified string is NULL, then any table with a connection string.
-*/
-
-struct close_cached_connection_tables_arg
-{
- THD *thd;
- LEX_CSTRING *connection;
- TABLE_LIST *tables;
-};
-
-
-static my_bool close_cached_connection_tables_callback(
- TDC_element *element, close_cached_connection_tables_arg *arg)
-{
- TABLE_LIST *tmp;
-
- mysql_mutex_lock(&element->LOCK_table_share);
- /* Ignore if table is not open or does not have a connect_string */
- if (!element->share || !element->share->connect_string.length ||
- !element->ref_count)
- goto end;
-
- /* Compare the connection string */
- if (arg->connection &&
- (arg->connection->length > element->share->connect_string.length ||
- (arg->connection->length < element->share->connect_string.length &&
- (element->share->connect_string.str[arg->connection->length] != '/' &&
- element->share->connect_string.str[arg->connection->length] != '\\')) ||
- strncasecmp(arg->connection->str, element->share->connect_string.str,
- arg->connection->length)))
- goto end;
-
- /* close_cached_tables() only uses these elements */
- if (!(tmp= (TABLE_LIST*) alloc_root(arg->thd->mem_root, sizeof(TABLE_LIST))) ||
- !(arg->thd->make_lex_string(&tmp->db, element->share->db.str, element->share->db.length)) ||
- !(arg->thd->make_lex_string(&tmp->table_name, element->share->table_name.str,
- element->share->table_name.length)))
- {
- mysql_mutex_unlock(&element->LOCK_table_share);
- return TRUE;
- }
-
- tmp->next_local= arg->tables;
- arg->tables= tmp;
-
-end:
- mysql_mutex_unlock(&element->LOCK_table_share);
- return FALSE;
-}
-
-
-/**
- Close cached connections
-
- @return false ok
- @return true If there was an error from closed_cached_connection_tables or
- if there was any open connections that we had to force closed
-*/
-
-bool close_cached_connection_tables(THD *thd, LEX_CSTRING *connection)
-{
- bool res= false;
- close_cached_connection_tables_arg argument;
- DBUG_ENTER("close_cached_connections");
- DBUG_ASSERT(thd);
-
- argument.thd= thd;
- argument.connection= connection;
- argument.tables= NULL;
-
- if (tdc_iterate(thd,
- (my_hash_walk_action) close_cached_connection_tables_callback,
- &argument))
- DBUG_RETURN(true);
-
- for (TABLE_LIST *table= argument.tables; table; table= table->next_local)
- res|= tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
- table->db.str,
- table->table_name.str);
-
- /* Return true if we found any open connections */
- DBUG_RETURN(res);
-}
-
-
/*
Mark all tables in the list which were used by current substatement
as free for reuse.