diff options
author | Sergei Petrunia <psergey@askmonty.org> | 2014-11-29 03:28:46 +0300 |
---|---|---|
committer | Sergei Petrunia <psergey@askmonty.org> | 2014-11-29 03:28:46 +0300 |
commit | c46eadb2b33ca152525a18d9b5425fedbef7f277 (patch) | |
tree | 125d506cc6d8fe91e0b163a7e9e2d3daddb1e787 /sql/sql_explain.cc | |
parent | e235bb864d2b8daae3dc7061249f59fb0127bdc5 (diff) | |
download | mariadb-git-c46eadb2b33ca152525a18d9b5425fedbef7f277.tar.gz |
EXPLAIN FORMAT=JSON: support EXPLAIN FORMAT=JSON INSERT ...
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r-- | sql/sql_explain.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 72973825f51..77ce692a2be 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -194,10 +194,7 @@ void Explain_query::print_explain_json(select_result_sink *output, bool is_analy if (upd_del_plan) upd_del_plan->print_explain_json(this, &writer, is_analyze); else if (insert_plan) - { - //insert_plan->print_explain(this, output, explain_flags, is_analyze); - DBUG_ASSERT(0); - } + insert_plan->print_explain_json(this, &writer, is_analyze); else { /* Start printing from node with id=1 */ @@ -1808,6 +1805,20 @@ int Explain_insert::print_explain(Explain_query *query, return print_explain_for_children(query, output, explain_flags, is_analyze); } +void Explain_insert::print_explain_json(Explain_query *query, + Json_writer *writer, bool is_analyze) +{ + Json_writer_nesting_guard guard(writer); + + writer->add_member("query_block").start_object(); + writer->add_member("select_id").add_ll(1); + writer->add_member("table").start_object(); + writer->add_member("table_name").add_str(table_name.c_ptr()); + writer->end_object(); // table + print_explain_json_for_children(query, writer, is_analyze); + writer->end_object(); // query_block +} + void delete_explain_query(LEX *lex) { |