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, ...@@ -1493,7 +1493,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->update_all_stats(); thd->update_all_stats();
log_slow_statement(thd); 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_proc_info(thd, "cleaning up");
thd->reset_query(); thd->reset_query();
...@@ -3351,9 +3350,8 @@ end_with_restore_list: ...@@ -3351,9 +3350,8 @@ end_with_restore_list:
else else
{ {
result->reset_offset_limit(); result->reset_offset_limit();
thd->lex->query_plan_footprint->print_explain(result, thd->lex->describe); thd->lex->query_plan_footprint->print_explain(result,
//delete thd->lex->query_plan_footprint; thd->lex->describe);
//thd->lex->query_plan_footprint= NULL;
} }
if (res) if (res)
...@@ -4881,9 +4879,14 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) ...@@ -4881,9 +4879,14 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
if (!(result= new select_send())) if (!(result= new select_send()))
return 1; /* purecov: inspected */ return 1; /* purecov: inspected */
thd->send_explain_fields(result); 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); res= mysql_explain_union(thd, &thd->lex->unit, result);
/* Print EXPLAIN only if we don't have an error */
if (!res) if (!res)
{ {
/* /*
...@@ -4891,20 +4894,9 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) ...@@ -4891,20 +4894,9 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
top-level LIMIT top-level LIMIT
*/ */
result->reset_offset_limit(); result->reset_offset_limit();
thd->lex->query_plan_footprint->print_explain(result, thd->lex->describe); thd->lex->query_plan_footprint->print_explain(result,
} thd->lex->describe);
//delete thd->lex->query_plan_footprint; if (lex->describe & DESCRIBE_EXTENDED)
//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))
{ {
char buff[1024]; char buff[1024];
String str(buff,(uint32) sizeof(buff), system_charset_info); String str(buff,(uint32) sizeof(buff), system_charset_info);
...@@ -4917,6 +4909,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) ...@@ -4917,6 +4909,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_YES, str.c_ptr_safe()); ER_YES, str.c_ptr_safe());
} }
}
if (res) if (res)
result->abort_result_set(); result->abort_result_set();
else 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