1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-6109: EXPLAIN JSON

- First code, "EXPLAIN FORMAT=JSON stmt" and "ANALYZE FORMAT=JSON stmt"
  work for basic queries.  Complex constructs (e.g subqueries, etc) not
  yet supported.
- No test infrastructure yet
This commit is contained in:
Sergei Petrunia
2014-05-27 21:04:45 +04:00
parent 0925ab9d88
commit 5cfd3270ec
15 changed files with 642 additions and 111 deletions

View File

@@ -2271,7 +2271,10 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
int THD::send_explain_fields(select_result *result)
{
List<Item> field_list;
make_explain_field_list(field_list);
if (lex->explain_json)
make_explain_json_field_list(field_list);
else
make_explain_field_list(field_list);
result->prepare(field_list, NULL);
return (result->send_result_set_metadata(field_list,
Protocol::SEND_NUM_ROWS |
@@ -2279,6 +2282,13 @@ int THD::send_explain_fields(select_result *result)
}
void THD::make_explain_json_field_list(List<Item> &field_list)
{
Item *item= new Item_empty_string("EXPLAIN", 78, system_charset_info);
field_list.push_back(item);
}
/*
Populate the provided field_list with EXPLAIN output columns.
this->lex->describe has the EXPLAIN flags