summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2014-08-09 01:52:54 +0400
committerSergei Petrunia <psergey@askmonty.org>2014-08-09 01:52:54 +0400
commit83f0ddc6294ea8d4e424a540a043bf88ee4a8c8d (patch)
tree04280aba1544710aac2a6971a8d86a41c11cbecc /sql/sql_yacc.yy
parentd87ffeb49133aa459e134f09924cd7b7b5013632 (diff)
parent5cfd3270ec79238b27765af3062ae7d97f6f06d0 (diff)
downloadmariadb-git-83f0ddc6294ea8d4e424a540a043bf88ee4a8c8d.tar.gz
Merge 10.1 (with ANALYZE) and 10.1-explain-json
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy39
1 files changed, 36 insertions, 3 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index a261d611aa6..eb0d359f608 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -1178,6 +1178,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token FORCE_SYM
%token FOREIGN /* SQL-2003-R */
%token FOR_SYM /* SQL-2003-R */
+%token FORMAT_SYM
%token FOUND_SYM /* SQL-2003-R */
%token FROM
%token FULL /* SQL-2003-R */
@@ -1847,6 +1848,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
subselect_end select_var_list select_var_list_init help
field_length opt_field_length
opt_extended_describe shutdown
+ opt_format_json
prepare prepare_src execute deallocate
statement sp_suid
sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa
@@ -9757,6 +9759,18 @@ function_call_conflict:
if ($$ == NULL)
MYSQL_YYABORT;
}
+ | FORMAT_SYM '(' expr ',' expr ')'
+ {
+ $$= new (thd->mem_root) Item_func_format($3, $5);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
+ | FORMAT_SYM '(' expr ',' expr ',' expr ')'
+ {
+ $$= new (thd->mem_root) Item_func_format($3, $5, $7);
+ if ($$ == NULL)
+ MYSQL_YYABORT;
+ }
| LAST_VALUE '(' expr_list ')'
{
$$= new (thd->mem_root) Item_func_last_value(* $3);
@@ -12769,16 +12783,34 @@ describe_command:
;
analyze_stmt_command:
- ANALYZE_SYM explainable_command
+ ANALYZE_SYM opt_format_json explainable_command
{
Lex->analyze_stmt= true;
}
;
opt_extended_describe:
- /* empty */ {}
- | EXTENDED_SYM { Lex->describe|= DESCRIBE_EXTENDED; }
+ EXTENDED_SYM { Lex->describe|= DESCRIBE_EXTENDED; }
| PARTITIONS_SYM { Lex->describe|= DESCRIBE_PARTITIONS; }
+ | opt_format_json {}
+ ;
+
+opt_format_json:
+ /* empty */ {}
+ | FORMAT_SYM EQ ident_or_text
+ {
+ if (!my_strcasecmp(system_charset_info, $3.str, "JSON"))
+ Lex->explain_json= true;
+ else if (!my_strcasecmp(system_charset_info, $3.str, "TRADITIONAL"))
+ {
+ DBUG_ASSERT(Lex->explain_json==false);
+ }
+ else
+ {
+ my_error(ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), $3.str);
+ MYSQL_YYABORT;
+ }
+ }
;
opt_describe_column:
@@ -14064,6 +14096,7 @@ keyword:
| EXAMINED_SYM {}
| EXECUTE_SYM {}
| FLUSH_SYM {}
+ | FORMAT_SYM {}
| GET_SYM {}
| HANDLER_SYM {}
| HELP_SYM {}