1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
This commit is contained in:
Igor Babaev
2009-11-09 18:32:39 -08:00
257 changed files with 12403 additions and 2740 deletions

View File

@ -1515,21 +1515,23 @@ void close_temporary_tables(THD *thd)
my_thread_id save_pseudo_thread_id= thd->variables.pseudo_thread_id;
/* Set pseudo_thread_id to be that of the processed table */
thd->variables.pseudo_thread_id= tmpkeyval(thd, table);
/*
Loop forward through all tables within the sublist of
common pseudo_thread_id to create single DROP query.
String db;
db.append(table->s->db.str);
/* Loop forward through all tables that belong to a common database
within the sublist of common pseudo_thread_id to create single
DROP query
*/
for (s_query.length(stub_len);
table && is_user_table(table) &&
tmpkeyval(thd, table) == thd->variables.pseudo_thread_id;
tmpkeyval(thd, table) == thd->variables.pseudo_thread_id &&
table->s->db.length == db.length() &&
strcmp(table->s->db.str, db.ptr()) == 0;
table= next)
{
/*
We are going to add 4 ` around the db/table names and possible more
due to special characters in the names
We are going to add ` around the table names and possible more
due to special characters
*/
append_identifier(thd, &s_query, table->s->db.str, strlen(table->s->db.str));
s_query.append('.');
append_identifier(thd, &s_query, table->s->table_name.str,
strlen(table->s->table_name.str));
s_query.append(',');
@ -1542,6 +1544,7 @@ void close_temporary_tables(THD *thd)
Query_log_event qinfo(thd, s_query.ptr(),
s_query.length() - 1 /* to remove trailing ',' */,
0, FALSE, 0);
qinfo.db= db.ptr();
thd->variables.character_set_client= cs_save;
mysql_bin_log.write(&qinfo);
thd->variables.pseudo_thread_id= save_pseudo_thread_id;