diff options
author | Alfranio Correia <alfranio.correia@sun.com> | 2009-08-28 10:29:04 +0100 |
---|---|---|
committer | Alfranio Correia <alfranio.correia@sun.com> | 2009-08-28 10:29:04 +0100 |
commit | 5edd807a7ab72fc16472293fc94a7eb8e762e2b7 (patch) | |
tree | 0342ee0b0c6f135ae7b3bcc0dfd671224e0d4cd1 /sql/sql_base.cc | |
parent | 367c14b854f4afe6cfd41b9f56bf8fbf3c337b65 (diff) | |
parent | ea06bbd2b0cc4e33b3350ef0bff25b0c1d1c2e95 (diff) | |
download | mariadb-git-5edd807a7ab72fc16472293fc94a7eb8e762e2b7.tar.gz |
auto-merge mysql-5.0-bugteam (local) --> mysql-5.0-bugteam
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 56ab50835b6..6a99d5d1541 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -769,19 +769,23 @@ void close_temporary_tables(THD *thd) { /* 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); + /* 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 && + strlen(table->s->db) == db.length() && + strcmp(table->s->db, 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, (uint) strlen(table->s->db)); - s_query.q_append('.'); append_identifier(thd, &s_query, table->s->table_name, (uint) strlen(table->s->table_name)); s_query.q_append(','); @@ -794,6 +798,7 @@ void close_temporary_tables(THD *thd) Query_log_event qinfo(thd, s_query.ptr(), s_query.length() - 1 /* to remove trailing ',' */, 0, FALSE, THD::NOT_KILLED); + qinfo.db= db.ptr(); thd->variables.character_set_client= cs_save; DBUG_ASSERT(qinfo.error_code == 0); mysql_bin_log.write(&qinfo); |