diff options
| author | Marko Mäkelä <marko.makela@mariadb.com> | 2023-04-11 16:15:19 +0300 |
|---|---|---|
| committer | Marko Mäkelä <marko.makela@mariadb.com> | 2023-04-11 16:15:19 +0300 |
| commit | 5bada1246de48ef4a18fa30388f06719c971c3d7 (patch) | |
| tree | 65de1dc70eebfc94385afadb7202b86a009425c8 /sql/sql_explain.cc | |
| parent | 375991a531f8885634e7a2af224bf396ee7e1f60 (diff) | |
| parent | fb72dfbf7fb52a4be12bad7f173baa71942fd558 (diff) | |
| download | mariadb-git-5bada1246de48ef4a18fa30388f06719c971c3d7.tar.gz | |
Merge 10.5 into 10.6
Diffstat (limited to 'sql/sql_explain.cc')
| -rw-r--r-- | sql/sql_explain.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 2874417d8df..e9bdc4be66f 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -161,7 +161,7 @@ void Explain_query::query_plan_ready() Send EXPLAIN output to the client. */ -int Explain_query::send_explain(THD *thd) +int Explain_query::send_explain(THD *thd, bool extended) { select_result *result; LEX *lex= thd->lex; @@ -174,8 +174,22 @@ int Explain_query::send_explain(THD *thd) if (thd->lex->explain_json) print_explain_json(result, thd->lex->analyze_stmt); else + { res= print_explain(result, lex->describe, thd->lex->analyze_stmt); - + if (extended) + { + char buff[1024]; + String str(buff,(uint32) sizeof(buff), system_charset_info); + str.length(0); + /* + The warnings system requires input in utf8, @see + mysqld_show_warnings(). + */ + lex->unit.print(&str, QT_EXPLAIN_EXTENDED); + push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, + ER_YES, str.c_ptr_safe()); + } + } if (res) result->abort_result_set(); else @@ -185,6 +199,7 @@ int Explain_query::send_explain(THD *thd) } + /* The main entry point to print EXPLAIN of the entire query */ |
