Commit d0bcc9dc authored by pem@mysql.com's avatar pem@mysql.com

Removed dummy SPSET construct.

Setting of SP local variables is now part of the existing SET syntax.

Note: This has the result that a somewhat extended syntax (from SQL-99)
is allowed. We allow a list of settings ("SET a=1, b=2, ...;"), where the
different variables can be of different types (SP local, system or user (@)).
This also means that certain optional modifiers, such as GLOBAL, are allowed
when setting an SP local variable, but then has no meaning and is ignored.
parent b88ef166
...@@ -352,7 +352,6 @@ static SYMBOL symbols[] = { ...@@ -352,7 +352,6 @@ static SYMBOL symbols[] = {
{ "SONAME", SYM(UDF_SONAME_SYM),0,0}, { "SONAME", SYM(UDF_SONAME_SYM),0,0},
{ "SPATIAL", SYM(SPATIAL_SYM),0,0}, { "SPATIAL", SYM(SPATIAL_SYM),0,0},
{ "SPECIFIC", SYM(SPECIFIC_SYM),0,0}, { "SPECIFIC", SYM(SPECIFIC_SYM),0,0},
{ "SPSET", SYM(SPSET_SYM),0,0}, /* Temp. until SET parsing solved. */
{ "SQL_BIG_RESULT", SYM(SQL_BIG_RESULT),0,0}, { "SQL_BIG_RESULT", SYM(SQL_BIG_RESULT),0,0},
{ "SQL_BUFFER_RESULT", SYM(SQL_BUFFER_RESULT),0,0}, { "SQL_BUFFER_RESULT", SYM(SQL_BUFFER_RESULT),0,0},
{ "SQL_CACHE", SYM(SQL_CACHE_SYM), 0, 0}, { "SQL_CACHE", SYM(SQL_CACHE_SYM), 0, 0},
......
...@@ -542,8 +542,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); ...@@ -542,8 +542,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token ASENSITIVE_SYM %token ASENSITIVE_SYM
%token INSENSITIVE_SYM %token INSENSITIVE_SYM
%token SENSITIVE_SYM %token SENSITIVE_SYM
/* QQ This is a dummy, until we have solved the SET syntax problem. */
%token SPSET_SYM
%token ISSUER_SYM %token ISSUER_SYM
%token SUBJECT_SYM %token SUBJECT_SYM
...@@ -1128,27 +1126,6 @@ sp_proc_stmt: ...@@ -1128,27 +1126,6 @@ sp_proc_stmt:
lex->sphead->add_instr(i); lex->sphead->add_instr(i);
} }
} }
|
/* QQ Dummy. We need to fix the old SET syntax to make it work for
local SP variables as well. */
SPSET_SYM ident EQ expr
{
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
sp_pvar_t *spv;
if (!spc || !(spv = spc->find_pvar(&$2)))
YYABORT; /* Unknow variable */
else
{
/* QQ Check type match! */
sp_instr_set *i = new sp_instr_set(lex->sphead->instructions(),
spv->offset, $4, spv->type);
lex->sphead->add_instr(i);
spv->isset= TRUE;
}
}
; ;
sp_if: sp_if:
...@@ -4471,11 +4448,8 @@ option_value: ...@@ -4471,11 +4448,8 @@ option_value:
{ {
Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4))); Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4)));
} }
| internal_variable_name equal set_expr_or_default | internal_or_splocal
{ {}
LEX *lex=Lex;
lex->var_list.push_back(new set_var(lex->option_type, $1, $3));
}
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -4521,6 +4495,32 @@ internal_variable_name: ...@@ -4521,6 +4495,32 @@ internal_variable_name:
} }
; ;
internal_or_splocal:
ident equal set_expr_or_default
{
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
sp_pvar_t *spv;
if (!spc || !(spv = spc->find_pvar(&$1)))
{ /* Not an SP local variable */
sys_var *tmp= find_sys_var($1.str, $1.length);
if (!tmp)
YYABORT;
lex->var_list.push_back(new set_var(lex->option_type, tmp, $3));
}
else
{ /* An SP local variable */
sp_instr_set *i= new sp_instr_set(lex->sphead->instructions(),
spv->offset, $3, spv->type);
lex->sphead->add_instr(i);
spv->isset= TRUE;
}
}
;
isolation_types: isolation_types:
READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; } READ_SYM UNCOMMITTED_SYM { $$= ISO_READ_UNCOMMITTED; }
| READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; } | READ_SYM COMMITTED_SYM { $$= ISO_READ_COMMITTED; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment