Commit e08c287c authored by ramil@mysql.com's avatar ramil@mysql.com

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/usr/home/ram/work/5.0.b10339
parents 66b6bbfa 4047905d
...@@ -180,6 +180,7 @@ select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4); ...@@ -180,6 +180,7 @@ select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
coercibility(@v1) coercibility(@v2) coercibility(@v3) coercibility(@v4) coercibility(@v1) coercibility(@v2) coercibility(@v3) coercibility(@v4)
2 2 2 2 2 2 2 2
set session @honk=99; set session @honk=99;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@honk=99' at line 1
set one_shot @honk=99; set one_shot @honk=99;
ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
set @first_var= NULL; set @first_var= NULL;
......
...@@ -116,6 +116,7 @@ select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4); ...@@ -116,6 +116,7 @@ select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
# #
# Bug #9286 SESSION/GLOBAL should be disallowed for user variables # Bug #9286 SESSION/GLOBAL should be disallowed for user variables
# #
--error 1064
set session @honk=99; set session @honk=99;
--error 1382 --error 1382
set one_shot @honk=99; set one_shot @honk=99;
......
...@@ -32,7 +32,7 @@ extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib; ...@@ -32,7 +32,7 @@ extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
enum enum_var_type enum enum_var_type
{ {
OPT_DEFAULT, OPT_SESSION, OPT_GLOBAL OPT_DEFAULT= 0, OPT_SESSION, OPT_GLOBAL
}; };
typedef int (*sys_check_func)(THD *, set_var *); typedef int (*sys_check_func)(THD *, set_var *);
......
...@@ -698,7 +698,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -698,7 +698,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
opt_var_ident_type delete_option opt_temporary all_or_any opt_distinct opt_var_ident_type delete_option opt_temporary all_or_any opt_distinct
opt_ignore_leaves fulltext_options spatial_type union_option opt_ignore_leaves fulltext_options spatial_type union_option
start_transaction_opts opt_chain opt_release start_transaction_opts opt_chain opt_release
union_opt select_derived_init union_opt select_derived_init option_type option_type2
%type <ulong_num> %type <ulong_num>
ulong_num raid_types merge_insert_types ulong_num raid_types merge_insert_types
...@@ -7475,7 +7475,7 @@ option_type_value: ...@@ -7475,7 +7475,7 @@ option_type_value:
lex->sphead->m_tmp_query= lex->tok_start; lex->sphead->m_tmp_query= lex->tok_start;
} }
} }
option_type option_value ext_option_value
{ {
LEX *lex= Lex; LEX *lex= Lex;
...@@ -7516,11 +7516,15 @@ option_type_value: ...@@ -7516,11 +7516,15 @@ option_type_value:
}; };
option_type: option_type:
/* empty */ {} option_type2 {}
| GLOBAL_SYM { Lex->option_type= OPT_GLOBAL; } | GLOBAL_SYM { $$=OPT_GLOBAL; }
| LOCAL_SYM { Lex->option_type= OPT_SESSION; } | LOCAL_SYM { $$=OPT_SESSION; }
| SESSION_SYM { Lex->option_type= OPT_SESSION; } | SESSION_SYM { $$=OPT_SESSION; }
| ONE_SHOT_SYM { Lex->option_type= OPT_SESSION; Lex->one_shot_set= 1; } ;
option_type2:
/* empty */ { $$= OPT_DEFAULT; }
| ONE_SHOT_SYM { Lex->one_shot_set= 1; $$= OPT_SESSION; }
; ;
opt_var_type: opt_var_type:
...@@ -7537,28 +7541,33 @@ opt_var_ident_type: ...@@ -7537,28 +7541,33 @@ opt_var_ident_type:
| SESSION_SYM '.' { $$=OPT_SESSION; } | SESSION_SYM '.' { $$=OPT_SESSION; }
; ;
option_value: ext_option_value:
'@' ident_or_text equal expr sys_option_value
{ | option_type2 option_value;
Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4)));
} sys_option_value:
| internal_variable_name equal set_expr_or_default option_type internal_variable_name equal set_expr_or_default
{ {
LEX *lex=Lex; LEX *lex=Lex;
if ($1.var == &trg_new_row_fake_var) if ($2.var == &trg_new_row_fake_var)
{ {
/* We are in trigger and assigning value to field of new row */ /* We are in trigger and assigning value to field of new row */
Item *it; Item *it;
sp_instr_set_trigger_field *i; sp_instr_set_trigger_field *i;
if ($1)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
if (lex->query_tables) if (lex->query_tables)
{ {
my_message(ER_SP_SUBSELECT_NYI, ER(ER_SP_SUBSELECT_NYI), my_message(ER_SP_SUBSELECT_NYI, ER(ER_SP_SUBSELECT_NYI),
MYF(0)); MYF(0));
YYABORT; YYABORT;
} }
if ($3) if ($4)
it= $3; it= $4;
else else
{ {
/* QQ: Shouldn't this be field's default value ? */ /* QQ: Shouldn't this be field's default value ? */
...@@ -7567,7 +7576,7 @@ option_value: ...@@ -7567,7 +7576,7 @@ option_value:
if (!(i= new sp_instr_set_trigger_field( if (!(i= new sp_instr_set_trigger_field(
lex->sphead->instructions(), lex->spcont, lex->sphead->instructions(), lex->spcont,
$1.base_name, it))) $2.base_name, it)))
YYABORT; YYABORT;
/* /*
...@@ -7579,10 +7588,12 @@ option_value: ...@@ -7579,10 +7588,12 @@ option_value:
lex->sphead->add_instr(i); lex->sphead->add_instr(i);
} }
else if ($1.var) else if ($2.var)
{ /* System variable */ { /* System variable */
lex->var_list.push_back(new set_var(lex->option_type, $1.var, if ($1)
&$1.base_name, $3)); lex->option_type= (enum_var_type)$1;
lex->var_list.push_back(new set_var(lex->option_type, $2.var,
&$2.base_name, $4));
} }
else else
{ {
...@@ -7591,11 +7602,16 @@ option_value: ...@@ -7591,11 +7602,16 @@ option_value:
sp_pvar_t *spv; sp_pvar_t *spv;
sp_instr_set *i; sp_instr_set *i;
Item *it; Item *it;
if ($1)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
spv= ctx->find_pvar(&$1.base_name); spv= ctx->find_pvar(&$2.base_name);
if ($3) if ($4)
it= $3; it= $4;
else if (spv->dflt) else if (spv->dflt)
it= spv->dflt; it= spv->dflt;
else else
...@@ -7606,19 +7622,28 @@ option_value: ...@@ -7606,19 +7622,28 @@ option_value:
spv->isset= TRUE; spv->isset= TRUE;
} }
} }
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default | option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
{
LEX *lex=Lex;
lex->var_list.push_back(new set_var((enum_var_type) $3, $4.var,
&$4.base_name, $6));
}
| TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!$1)
lex->option_type= (enum_var_type)$1;
lex->var_list.push_back(new set_var(lex->option_type, lex->var_list.push_back(new set_var(lex->option_type,
find_sys_var("tx_isolation"), find_sys_var("tx_isolation"),
&null_lex_str, &null_lex_str,
new Item_int((int32) $4))); new Item_int((int32) $5)));
}
;
option_value:
'@' ident_or_text equal expr
{
Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4)));
}
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
{
LEX *lex=Lex;
lex->var_list.push_back(new set_var((enum_var_type) $3, $4.var,
&$4.base_name, $6));
} }
| charset old_or_new_charset_name_or_default | charset old_or_new_charset_name_or_default
{ {
......
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