diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-04-18 19:34:12 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-03-12 13:10:48 +0100 |
commit | 83123412f00d9b69f1c5ea39b160d1d27be701a9 (patch) | |
tree | d9192c723230a21c504930504ebcb15bf78670a7 /sql/sql_class.cc | |
parent | 01c49e66b559d311725ff4c0d86592c3c9eaa58d (diff) | |
download | mariadb-git-83123412f00d9b69f1c5ea39b160d1d27be701a9.tar.gz |
MDEV-11975: SQLCOM_PREPARE of EXPLAIN & ANALYZE statement do not return correct metadata info
Added metadate info after prepare EXPLAIN/ANALYZE.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r-- | sql/sql_class.cc | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0971d4fdaaa..628dcee0570 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2405,18 +2405,31 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length) } -int THD::send_explain_fields(select_result *result, uint8 explain_flags, bool is_analyze) +void THD::prepare_explain_fields(select_result *result, + List<Item> *field_list, + uint8 explain_flags, + bool is_analyze) { - List<Item> field_list; if (lex->explain_json) - make_explain_json_field_list(field_list, is_analyze); + make_explain_json_field_list(*field_list, is_analyze); else - make_explain_field_list(field_list, explain_flags, is_analyze); + make_explain_field_list(*field_list, explain_flags, is_analyze); + + result->prepare(*field_list, NULL); +} - result->prepare(field_list, NULL); - return (result->send_result_set_metadata(field_list, - Protocol::SEND_NUM_ROWS | - Protocol::SEND_EOF)); + +int THD::send_explain_fields(select_result *result, + uint8 explain_flags, + bool is_analyze) +{ + List<Item> field_list; + int rc; + prepare_explain_fields(result, &field_list, explain_flags, is_analyze); + rc= result->send_result_set_metadata(field_list, + Protocol::SEND_NUM_ROWS | + Protocol::SEND_EOF); + return(rc); } |