Commit 3aaeb730 authored by Sergey Petrunya's avatar Sergey Petrunya

Code cleanup

parent c0028bd2
......@@ -1493,7 +1493,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->update_all_stats();
log_slow_statement(thd);
/* psergey-todo: this is the place we could print EXPLAIN to slow query log */
thd_proc_info(thd, "cleaning up");
thd->reset_query();
......@@ -3351,9 +3350,8 @@ end_with_restore_list:
else
{
result->reset_offset_limit();
thd->lex->query_plan_footprint->print_explain(result, thd->lex->describe);
//delete thd->lex->query_plan_footprint;
//thd->lex->query_plan_footprint= NULL;
thd->lex->query_plan_footprint->print_explain(result,
thd->lex->describe);
}
if (res)
......@@ -4881,9 +4879,14 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
if (!(result= new select_send()))
return 1; /* purecov: inspected */
thd->send_explain_fields(result);
//thd->lex->query_plan_footprint= new QPF_query;
/*
This will call optimize() for all parts of query. The query plan is
printed out below.
*/
res= mysql_explain_union(thd, &thd->lex->unit, result);
/* Print EXPLAIN only if we don't have an error */
if (!res)
{
/*
......@@ -4891,20 +4894,9 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
top-level LIMIT
*/
result->reset_offset_limit();
thd->lex->query_plan_footprint->print_explain(result, thd->lex->describe);
}
//delete thd->lex->query_plan_footprint;
//thd->lex->query_plan_footprint= NULL;
//psergey-todo: here, produce the EXPLAIN output.
// mysql_explain_union() itself is only responsible for calling
// optimize() for all parts of the query.
/*
The code which prints the extended description is not robust
against malformed queries, so skip it if we have an error.
*/
if (!res && (lex->describe & DESCRIBE_EXTENDED))
thd->lex->query_plan_footprint->print_explain(result,
thd->lex->describe);
if (lex->describe & DESCRIBE_EXTENDED)
{
char buff[1024];
String str(buff,(uint32) sizeof(buff), system_charset_info);
......@@ -4917,6 +4909,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_YES, str.c_ptr_safe());
}
}
if (res)
result->abort_result_set();
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment