diff options
| author | Oleg Smirnov <olernov@gmail.com> | 2022-01-11 20:25:11 +0300 |
|---|---|---|
| committer | Sergei Petrunia <sergey@mariadb.com> | 2022-04-29 10:47:03 +0300 |
| commit | 328684833b3e6e8fad5a71a4c6aa1676cb6c6e37 (patch) | |
| tree | 74982c279a4976aff3eff766d8deb37204994abf /sql/sql_explain.cc | |
| parent | 51b28b24ca3a33a3a9b2a844c6c8a94df1bad253 (diff) | |
| download | mariadb-git-328684833b3e6e8fad5a71a4c6aa1676cb6c6e37.tar.gz | |
MDEV-10000 Add EXPLAIN [FORMAT=JSON] FOR CONNECTION syntax support
EXPLAIN FOR CONNECTION is a MySQL-compatible syntax for SHOW EXPLAIN.
This commit also adds support for FORMAT=JSON to SHOW EXPLAIN,
so the possible options to get JSON-formatted output are:
- SHOW EXPLAIN FORMAT=JSON FOR $con
- EXPLAIN FORMAT=JSON FOR CONNECTION $con
Diffstat (limited to 'sql/sql_explain.cc')
| -rw-r--r-- | sql/sql_explain.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 3cee9bbb2c5..bef60b94249 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -215,7 +215,7 @@ int Explain_query::print_explain(select_result_sink *output, } -void Explain_query::print_explain_json(select_result_sink *output, +int Explain_query::print_explain_json(select_result_sink *output, bool is_analyze) { Json_writer writer; @@ -230,7 +230,7 @@ void Explain_query::print_explain_json(select_result_sink *output, /* Start printing from node with id=1 */ Explain_node *node= get_node(1); if (!node) - return; /* No query plan */ + return 1; /* No query plan */ node->print_explain_json(this, &writer, is_analyze); } @@ -243,6 +243,7 @@ void Explain_query::print_explain_json(select_result_sink *output, Item_string(thd, buf->ptr(), buf->length(), cs), thd->mem_root); output->send_data(item_list); + return 0; } |
