summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2004-05-06 23:02:32 +0400
committerunknown <sergefp@mysql.com>2004-05-06 23:02:32 +0400
commit6810ca1b71e049cc86adbc12bebedbce41d03a7c (patch)
tree50153bc4a1b4f760b75c16f4627a54730d261de3 /sql/sql_yacc.yy
parent151495baf78b0a5e282a0e77fdba1a7a2a8a3085 (diff)
parent60017fb2609f6993e941f662d79a8f1d44cfa11b (diff)
downloadmariadb-git-6810ca1b71e049cc86adbc12bebedbce41d03a7c.tar.gz
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/dbdata/psergey/mysql-4.1-ps-merge sql/item.cc: Auto merged sql/item.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy73
1 files changed, 73 insertions, 0 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0d499a300db..7cca990b4c5 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -432,6 +432,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MEDIUMTEXT
%token NUMERIC_SYM
%token PRECISION
+%token PREPARE_SYM
+%token DEALLOCATE_SYM
%token QUICK
%token REAL
%token SIGNED_SYM
@@ -724,6 +726,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
precision subselect_start opt_and charset
subselect_end select_var_list select_var_list_init help opt_len
opt_extended_describe
+ prepare execute deallocate
END_OF_INPUT
%type <NONE>
@@ -760,10 +763,12 @@ verb_clause:
| checksum
| commit
| create
+ | deallocate
| delete
| describe
| do
| drop
+ | execute
| flush
| grant
| handler
@@ -775,6 +780,7 @@ verb_clause:
| optimize
| keycache
| preload
+ | prepare
| purge
| rename
| repair
@@ -795,6 +801,71 @@ verb_clause:
| use
;
+deallocate:
+ DEALLOCATE_SYM PREPARE_SYM ident
+ {
+ THD *thd=YYTHD;
+ LEX *lex= thd->lex;
+ if (thd->command == COM_PREPARE)
+ {
+ yyerror(ER(ER_SYNTAX_ERROR));
+ YYABORT;
+ }
+ lex->sql_command= SQLCOM_DEALLOCATE_PREPARE;
+ lex->prepared_stmt_name= $3;
+ };
+
+prepare:
+ PREPARE_SYM ident FROM TEXT_STRING_sys
+ {
+ THD *thd=YYTHD;
+ LEX *lex= thd->lex;
+ if (thd->command == COM_PREPARE)
+ {
+ yyerror(ER(ER_SYNTAX_ERROR));
+ YYABORT;
+ }
+ lex->sql_command= SQLCOM_PREPARE;
+ lex->prepared_stmt_name= $2;
+ lex->prepared_stmt_code= $4;
+ };
+
+execute:
+ EXECUTE_SYM ident
+ {
+ THD *thd=YYTHD;
+ LEX *lex= thd->lex;
+ if (thd->command == COM_PREPARE)
+ {
+ yyerror(ER(ER_SYNTAX_ERROR));
+ YYABORT;
+ }
+ lex->sql_command= SQLCOM_EXECUTE;
+ lex->prepared_stmt_name= $2;
+ }
+ execute_using
+ {}
+ ;
+
+execute_using:
+ /* nothing */
+ | USING execute_var_list
+ ;
+
+execute_var_list:
+ execute_var_list ',' execute_var_ident
+ | execute_var_ident
+ ;
+
+execute_var_ident: '@' ident_or_text
+ {
+ LEX *lex=Lex;
+ LEX_STRING *lexstr= (LEX_STRING*)sql_memdup(&$2, sizeof(LEX_STRING));
+ if (!lexstr || lex->prepared_stmt_params.push_back(lexstr))
+ YYABORT;
+ }
+ ;
+
/* help */
help:
@@ -4918,6 +4989,7 @@ keyword:
| DATETIME {}
| DATE_SYM {}
| DAY_SYM {}
+ | DEALLOCATE_SYM {}
| DELAY_KEY_WRITE_SYM {}
| DES_KEY_FILE {}
| DIRECTORY_SYM {}
@@ -5016,6 +5088,7 @@ keyword:
| PASSWORD {}
| POINT_SYM {}
| POLYGON {}
+ | PREPARE_SYM {}
| PREV_SYM {}
| PROCESS {}
| PROCESSLIST_SYM {}