1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Make SHOW EXPLAIN FOR produce a warning with the original text of query

that the EXPLAIN is for.
This commit is contained in:
Sergey Petrunya
2012-04-26 08:48:31 +05:30
parent 9b269ea11b
commit ff40705f89
4 changed files with 46 additions and 5 deletions

View File

@ -3030,14 +3030,20 @@ void Show_explain_request::get_explain_data(void *arg)
//TODO: change mem_root to point to request_thd->mem_root.
// Actually, change the ARENA, because we're going to allocate items!
Query_arena backup_arena;
req->target_thd->set_n_backup_active_arena((Query_arena*)req->request_thd,
&backup_arena);
THD *target_thd= req->target_thd;
if (req->target_thd->lex->unit.print_explain(req->explain_buf))
target_thd->set_n_backup_active_arena((Query_arena*)req->request_thd,
&backup_arena);
req->query_str.copy(target_thd->query(),
target_thd->query_length(),
&my_charset_bin);
if (target_thd->lex->unit.print_explain(req->explain_buf))
req->failed_to_produce= TRUE;
req->target_thd->restore_active_arena((Query_arena*)req->request_thd,
&backup_arena);
target_thd->restore_active_arena((Query_arena*)req->request_thd,
&backup_arena);
}