summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorOleg Smirnov <olernov@gmail.com>2022-01-13 19:24:22 +0300
committerOleg Smirnov <olernov@gmail.com>2022-01-13 19:26:58 +0300
commit3c4b97d8b8cdab5c3b03e1cbaa44cc7e511d5bce (patch)
tree66175172beecd212e2a8df8b7d83ffd4b4c1301a /sql/sql_yacc.yy
parent8e6595cff0caa22d2bb81002505e52b5c52f5ab2 (diff)
downloadmariadb-git-bb-10.8-MDEV-10000.tar.gz
MDEV-10000 Add support for FORMAT=JSONbb-10.8-MDEV-10000
Makes possible calls to SHOW EXPLAIN and EXPLAIN FOR CONNECTION providing output in JSON format: - SHOW EXPLAIN FORMAT=JSON FOR $con - EXPLAIN FORMAT=JSON FOR CONNECTION $con
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy14
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 74757970411..6df21338881 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -13945,12 +13945,13 @@ show_param:
Lex->spname= $3;
Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
}
- | describe_command FOR_SYM expr
+ | describe_command opt_format_json FOR_SYM expr
{
Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
- if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_EXPLAIN)))
+ if (unlikely(prepare_schema_table(thd, Lex, 0,
+ Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR)))
MYSQL_YYABORT;
- add_value_to_list(thd, $3);
+ add_value_to_list(thd, $4);
}
| IDENT_sys remember_tok_start wild_and_where
{
@@ -14123,12 +14124,13 @@ opt_describe_column:
;
explain_for_connection:
- describe_command FOR_SYM CONNECTION_SYM expr
+ describe_command opt_format_json FOR_SYM CONNECTION_SYM expr
{
Lex->sql_command= SQLCOM_SHOW_EXPLAIN;
- if (unlikely(prepare_schema_table(thd, Lex, 0, SCH_EXPLAIN)))
+ if (unlikely(prepare_schema_table(thd, Lex, 0,
+ Lex->explain_json ? SCH_EXPLAIN_JSON : SCH_EXPLAIN_TABULAR)))
MYSQL_YYABORT;
- add_value_to_list(thd, $4);
+ add_value_to_list(thd, $5);
}
;