summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorSergey Petrunya <psergey@askmonty.org>2013-02-12 08:20:14 +0400
committerSergey Petrunya <psergey@askmonty.org>2013-02-12 08:20:14 +0400
commit18fec5128b6fd9712f63e306f03f16833f2599b2 (patch)
treed4f4f4428c6402146c05244504c63ad9a0b14989 /sql/sql_lex.cc
parenta555ceb2fb75c9958e39c963ca2a83e615629711 (diff)
downloadmariadb-git-18fec5128b6fd9712f63e306f03f16833f2599b2.tar.gz
EXPLAIN DELETE for MariaDB
- Backported the code to 10.0-base - Removed incorrect assert
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc31
1 files changed, 20 insertions, 11 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index b8ce3b6720e..74e4b3e1162 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -448,6 +448,7 @@ void lex_start(THD *thd)
lex->thd= lex->unit.thd= thd;
+ lex->delete_plan= NULL;
lex->context_stack.empty();
lex->unit.init_query();
lex->unit.init_select();
@@ -2557,6 +2558,7 @@ LEX::LEX()
INITIAL_LEX_PLUGIN_LIST_SIZE, 0);
reset_query_tables_list(TRUE);
mi.init();
+ delete_plan= NULL;
}
@@ -4166,12 +4168,17 @@ bool st_select_lex::is_merged_child_of(st_select_lex *ancestor)
return all_merged;
}
-
-int print_explain_message_line(select_result_sink *result,
- SELECT_LEX *select_lex,
- bool on_the_fly,
- uint8 options,
- const char *message);
+int LEX::print_explain(select_result_sink *output, uint8 explain_flags,
+ bool *printed_anything)
+{
+ if (delete_plan)
+ {
+ delete_plan->print_explain(output, explain_flags, printed_anything);
+ return 0;
+ }
+ int res= unit.print_explain(output, explain_flags, printed_anything);
+ return res;
+}
int st_select_lex::print_explain(select_result_sink *output,
@@ -4235,8 +4242,9 @@ int st_select_lex::print_explain(select_result_sink *output,
DBUG_ASSERT(join->have_query_plan == JOIN::QEP_DELETED);
msg= "Query plan already deleted";
}
- res= print_explain_message_line(output, this, TRUE /* on_the_fly */,
- 0, msg);
+ set_explain_type(TRUE/* on_the_fly */);
+ res= print_explain_message_line(output, 0/*options*/, select_number, type,
+ msg);
}
err:
return res;
@@ -4256,9 +4264,10 @@ int st_select_lex_unit::print_explain(select_result_sink *output,
EXPLAIN state" error.
*/
const char *msg="Query plan already deleted";
- res= print_explain_message_line(output, first, TRUE /* on_the_fly */,
- 0, msg);
- return 0;
+ first->set_explain_type(TRUE/* on_the_fly */);
+ res= print_explain_message_line(output, 0/*options*/, first->select_number,
+ first->type, msg);
+ return res;
}
for (SELECT_LEX *sl= first; sl; sl= sl->next_select())