735
Close all tables which match specified connection string or
736
if specified string is NULL, then any table with a connection string.
739
bool close_cached_connection_tables(Session *session, bool if_wait_for_refresh,
740
LEX_STRING *connection, bool have_lock)
743
TableList tmp, *tables= NULL;
748
pthread_mutex_lock(&LOCK_open);
750
for (idx= 0; idx < table_def_cache.records; idx++)
752
TableShare *share= (TableShare *) hash_element(&table_def_cache, idx);
754
/* Ignore if table is not open or does not have a connect_string */
755
if (!share->connect_string.length || !share->ref_count)
758
/* Compare the connection string */
760
(connection->length > share->connect_string.length ||
761
(connection->length < share->connect_string.length &&
762
(share->connect_string.str[connection->length] != '/' &&
763
share->connect_string.str[connection->length] != '\\')) ||
764
strncasecmp(connection->str, share->connect_string.str,
765
connection->length)))
768
/* close_cached_tables() only uses these elements */
769
tmp.db= share->db.str;
770
tmp.table_name= share->table_name.str;
771
tmp.next_local= tables;
773
tables= (TableList *) memdup_root(session->mem_root, (char*)&tmp,
778
result= close_cached_tables(session, tables, true, false, false);
781
pthread_mutex_unlock(&LOCK_open);
783
if (if_wait_for_refresh)
785
pthread_mutex_lock(&session->mysys_var->mutex);
786
session->mysys_var->current_mutex= 0;
787
session->mysys_var->current_cond= 0;
788
session->set_proc_info(0);
789
pthread_mutex_unlock(&session->mysys_var->mutex);
797
735
Auxiliary function to close all tables in the open_tables list.
5622
free all unused tables
5625
This is called by 'handle_manager' when one wants to periodicly flush
5626
all not used tables.
5631
(void) pthread_mutex_lock(&LOCK_open);
5632
while (unused_tables)
5633
hash_delete(&open_cache,(unsigned char*) unused_tables);
5634
(void) pthread_mutex_unlock(&LOCK_open);
5639
5560
Mark all entries with the table as deleted to force an reopen of the table
5641
5562
The table will be closed (not stored in cache) by the current thread when