summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc36
1 files changed, 14 insertions, 22 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index ffe54310843..6d35c441368 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2128,29 +2128,21 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
they have their own table list).
*/
for (TABLE_LIST *tables= lex->query_tables;
- tables;
- tables= tables->next_global)
+ tables;
+ tables= tables->next_global)
+ {
+ tables->reinit_before_use(thd);
+ }
+ /*
+ Cleanup of the special case of DELETE t1, t2 FROM t1, t2, t3 ...
+ (multi-delete). We do a full clean up, although at the moment all we
+ need to clean in the tables of MULTI-DELETE list is 'table' member.
+ */
+ for (TABLE_LIST *tables= (TABLE_LIST*) lex->auxiliary_table_list.first;
+ tables;
+ tables= tables->next_global)
{
- /*
- Reset old pointers to TABLEs: they are not valid since the tables
- were closed in the end of previous prepare or execute call.
- */
tables->reinit_before_use(thd);
-
- /* Reset is_schema_table_processed value(needed for I_S tables */
- tables->is_schema_table_processed= FALSE;
-
- TABLE_LIST *embedded; /* The table at the current level of nesting. */
- TABLE_LIST *embedding= tables; /* The parent nested table reference. */
- do
- {
- embedded= embedding;
- if (embedded->prep_on_expr)
- embedded->on_expr= embedded->prep_on_expr->copy_andor_structure(thd);
- embedding= embedded->embedding;
- }
- while (embedding &&
- embedding->nested_join->join_list.head() == embedded);
}
lex->current_select= &lex->select_lex;
@@ -2165,7 +2157,7 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
}
lex->allow_sum_func= 0;
lex->in_sum_func= NULL;
- DBUG_VOID_RETURN;
+ DBUG_VOID_RETURN;
}