Commit 09464dde authored by Sergei Golubchik's avatar Sergei Golubchik

small parser cleanup

* my_yyabort_error() helper
* s/lex->thd/thd/
* remove 'else' after MYSQL_YYABORT (for consistency,
  95% of the parser did not use 'else' in this case)
* simplify ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
parent bf9404d3
...@@ -6136,7 +6136,7 @@ ER_SLAVE_HEARTBEAT_FAILURE ...@@ -6136,7 +6136,7 @@ ER_SLAVE_HEARTBEAT_FAILURE
eng "Unexpected master's heartbeat data: %s" eng "Unexpected master's heartbeat data: %s"
ger "Unerwartete Daten vom Heartbeat des Masters: %s" ger "Unerwartete Daten vom Heartbeat des Masters: %s"
ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE
eng "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%s seconds)." eng "The requested value for the heartbeat period is either negative or exceeds the maximum allowed (%u seconds)."
ER_UNUSED_14 ER_UNUSED_14
eng "You should never see it" eng "You should never see it"
ER_CONFLICT_FN_PARSE_ERROR ER_CONFLICT_FN_PARSE_ERROR
......
...@@ -99,6 +99,9 @@ int yylex(void *yylval, void *yythd); ...@@ -99,6 +99,9 @@ int yylex(void *yylval, void *yythd);
MYSQL_YYABORT; \ MYSQL_YYABORT; \
} }
#define my_yyabort_error(A) \
do { my_error A; MYSQL_YYABORT; } while(0)
#ifndef DBUG_OFF #ifndef DBUG_OFF
#define YYDEBUG 1 #define YYDEBUG 1
#else #else
...@@ -2024,10 +2027,8 @@ query: ...@@ -2024,10 +2027,8 @@ query:
{ {
if (!thd->bootstrap && if (!thd->bootstrap &&
(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))) (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
{ my_yyabort_error((ER_EMPTY_QUERY, MYF(0)));
my_message(ER_EMPTY_QUERY, ER_THD(thd, ER_EMPTY_QUERY), MYF(0));
MYSQL_YYABORT;
}
thd->lex->sql_command= SQLCOM_EMPTY_QUERY; thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
YYLIP->found_semicolon= NULL; YYLIP->found_semicolon= NULL;
} }
...@@ -2210,10 +2211,7 @@ help: ...@@ -2210,10 +2211,7 @@ help:
HELP_SYM HELP_SYM
{ {
if (Lex->sphead) if (Lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HELP"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "HELP");
MYSQL_YYABORT;
}
} }
ident_or_text ident_or_text
{ {
...@@ -2304,13 +2302,9 @@ master_def: ...@@ -2304,13 +2302,9 @@ master_def:
Lex->mi.heartbeat_period= (float) $3->val_real(); Lex->mi.heartbeat_period= (float) $3->val_real();
if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD || if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
Lex->mi.heartbeat_period < 0.0) Lex->mi.heartbeat_period < 0.0)
{ my_yyabort_error((ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0),
const char format[]= "%d"; SLAVE_MAX_HEARTBEAT_PERIOD));
char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)];
sprintf(buf, format, SLAVE_MAX_HEARTBEAT_PERIOD);
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, MYF(0), buf);
MYSQL_YYABORT;
}
if (Lex->mi.heartbeat_period > slave_net_timeout) if (Lex->mi.heartbeat_period > slave_net_timeout)
{ {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
...@@ -2418,28 +2412,19 @@ master_file_def: ...@@ -2418,28 +2412,19 @@ master_file_def:
| MASTER_USE_GTID_SYM EQ CURRENT_POS_SYM | MASTER_USE_GTID_SYM EQ CURRENT_POS_SYM
{ {
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
{ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid");
MYSQL_YYABORT;
}
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS; Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_CURRENT_POS;
} }
| MASTER_USE_GTID_SYM EQ SLAVE_POS_SYM | MASTER_USE_GTID_SYM EQ SLAVE_POS_SYM
{ {
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
{ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid");
MYSQL_YYABORT;
}
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS; Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_SLAVE_POS;
} }
| MASTER_USE_GTID_SYM EQ NO_SYM | MASTER_USE_GTID_SYM EQ NO_SYM
{ {
if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED) if (Lex->mi.use_gtid_opt != LEX_MASTER_INFO::LEX_GTID_UNCHANGED)
{ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid"));
my_error(ER_DUP_ARGUMENT, MYF(0), "MASTER_use_gtid");
MYSQL_YYABORT;
}
Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_NO; Lex->mi.use_gtid_opt= LEX_MASTER_INFO::LEX_GTID_NO;
} }
; ;
...@@ -2459,10 +2444,7 @@ connection_name: ...@@ -2459,10 +2444,7 @@ connection_name:
Lex->mi.connection_name= $1; Lex->mi.connection_name= $1;
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
if (check_master_connection_name(&$1)) if (check_master_connection_name(&$1))
{ my_yyabort_error((ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME"));
my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_CONNECTION_NAME");
MYSQL_YYABORT;
}
#endif #endif
} }
; ;
...@@ -2772,10 +2754,7 @@ ev_sql_stmt: ...@@ -2772,10 +2754,7 @@ ev_sql_stmt:
- CREATE PROCEDURE ... BEGIN DROP EVENT ... END| - CREATE PROCEDURE ... BEGIN DROP EVENT ... END|
*/ */
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_EVENT_RECURSION_FORBIDDEN, MYF(0)));
my_error(ER_EVENT_RECURSION_FORBIDDEN, MYF(0));
MYSQL_YYABORT;
}
if (!make_sp_head(thd, lex->event_parse_data->identifier, TYPE_ENUM_PROCEDURE)) if (!make_sp_head(thd, lex->event_parse_data->identifier, TYPE_ENUM_PROCEDURE))
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -2814,14 +2793,9 @@ sp_name: ...@@ -2814,14 +2793,9 @@ sp_name:
ident '.' ident ident '.' ident
{ {
if (!$1.str || check_db_name(&$1)) if (!$1.str || check_db_name(&$1))
{ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
MYSQL_YYABORT;
}
if (check_routine_name(&$3)) if (check_routine_name(&$3))
{
MYSQL_YYABORT; MYSQL_YYABORT;
}
$$= new (thd->mem_root) sp_name($1, $3, true); $$= new (thd->mem_root) sp_name($1, $3, true);
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -2837,7 +2811,7 @@ sp_name: ...@@ -2837,7 +2811,7 @@ sp_name:
} }
if (lex->copy_db_to(&db.str, &db.length)) if (lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT; MYSQL_YYABORT;
$$= new (lex->thd->mem_root) sp_name(db, $1, false); $$= new (thd->mem_root) sp_name(db, $1, false);
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
$$->init_qname(thd); $$->init_qname(thd);
...@@ -2942,10 +2916,7 @@ sp_param_name_and_type: ...@@ -2942,10 +2916,7 @@ sp_param_name_and_type:
sp_pcontext *spc= lex->spcont; sp_pcontext *spc= lex->spcont;
if (spc->find_variable($1, TRUE)) if (spc->find_variable($1, TRUE))
{ my_yyabort_error((ER_SP_DUP_PARAM, MYF(0), $1.str));
my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
MYSQL_YYABORT;
}
sp_variable *spvar= spc->add_variable(thd, $1); sp_variable *spvar= spc->add_variable(thd, $1);
...@@ -3015,17 +2986,9 @@ sp_decls: ...@@ -3015,17 +2986,9 @@ sp_decls:
shift/reduce conflicts with the wrong result. (And we get shift/reduce conflicts with the wrong result. (And we get
better error handling this way.) */ better error handling this way.) */
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs)) if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
{ /* Variable or condition following cursor or handler */ my_yyabort_error((ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0)));
my_message(ER_SP_VARCOND_AFTER_CURSHNDLR,
ER_THD(thd, ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0));
MYSQL_YYABORT;
}
if ($2.curs && $1.hndlrs) if ($2.curs && $1.hndlrs)
{ /* Cursor following handler */ my_yyabort_error((ER_SP_CURSOR_AFTER_HANDLER, MYF(0)));
my_message(ER_SP_CURSOR_AFTER_HANDLER,
ER_THD(thd, ER_SP_CURSOR_AFTER_HANDLER), MYF(0));
MYSQL_YYABORT;
}
$$.vars= $1.vars + $2.vars; $$.vars= $1.vars + $2.vars;
$$.conds= $1.conds + $2.conds; $$.conds= $1.conds + $2.conds;
$$.hndlrs= $1.hndlrs + $2.hndlrs; $$.hndlrs= $1.hndlrs + $2.hndlrs;
...@@ -3092,16 +3055,11 @@ sp_decl: ...@@ -3092,16 +3055,11 @@ sp_decl:
/* The last instruction is responsible for freeing LEX. */ /* The last instruction is responsible for freeing LEX. */
sp_instr_set *is= (new (lex->thd->mem_root) sp_instr_set *is= new (thd->mem_root)
sp_instr_set(lex->sphead->instructions(), sp_instr_set(lex->sphead->instructions(),
pctx, pctx, var_idx, dflt_value_item,
var_idx, var_type, lex, last);
dflt_value_item, if (is == NULL || lex->sphead->add_instr(is))
var_type,
lex,
last));
if (is == NULL ||
lex->sphead->add_instr(is))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
...@@ -3117,10 +3075,7 @@ sp_decl: ...@@ -3117,10 +3075,7 @@ sp_decl:
sp_pcontext *spc= lex->spcont; sp_pcontext *spc= lex->spcont;
if (spc->find_condition($2, TRUE)) if (spc->find_condition($2, TRUE))
{ my_yyabort_error((ER_SP_DUP_COND, MYF(0), $2.str));
my_error(ER_SP_DUP_COND, MYF(0), $2.str);
MYSQL_YYABORT;
}
if(spc->add_condition(thd, $2, $5)) if(spc->add_condition(thd, $2, $5))
MYSQL_YYABORT; MYSQL_YYABORT;
$$.vars= $$.hndlrs= $$.curs= 0; $$.vars= $$.hndlrs= $$.curs= 0;
...@@ -3139,7 +3094,7 @@ sp_decl: ...@@ -3139,7 +3094,7 @@ sp_decl:
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
sp_instr_hpush_jump *i= sp_instr_hpush_jump *i=
new (lex->thd->mem_root) sp_instr_hpush_jump(sp->instructions(), new (thd->mem_root) sp_instr_hpush_jump(sp->instructions(),
ctx, h); ctx, h);
if (i == NULL || sp->add_instr(i)) if (i == NULL || sp->add_instr(i))
...@@ -3163,7 +3118,7 @@ sp_decl: ...@@ -3163,7 +3118,7 @@ sp_decl:
if ($2 == sp_handler::CONTINUE) if ($2 == sp_handler::CONTINUE)
{ {
i= new (lex->thd->mem_root) i= new (thd->mem_root)
sp_instr_hreturn(sp->instructions(), ctx); sp_instr_hreturn(sp->instructions(), ctx);
if (i == NULL || if (i == NULL ||
sp->add_instr(i)) sp->add_instr(i))
...@@ -3171,7 +3126,7 @@ sp_decl: ...@@ -3171,7 +3126,7 @@ sp_decl:
} }
else else
{ /* EXIT or UNDO handler, just jump to the end of the block */ { /* EXIT or UNDO handler, just jump to the end of the block */
i= new (lex->thd->mem_root) i= new (thd->mem_root)
sp_instr_hreturn(sp->instructions(), ctx); sp_instr_hreturn(sp->instructions(), ctx);
if (i == NULL || if (i == NULL ||
sp->add_instr(i) || sp->add_instr(i) ||
...@@ -3194,17 +3149,12 @@ sp_decl: ...@@ -3194,17 +3149,12 @@ sp_decl:
sp_instr_cpush *i; sp_instr_cpush *i;
if (ctx->find_cursor($2, &offp, TRUE)) if (ctx->find_cursor($2, &offp, TRUE))
{ my_yyabort_error((ER_SP_DUP_CURS, MYF(0), $2.str));
my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
delete $5; i= new (thd->mem_root)
MYSQL_YYABORT; sp_instr_cpush(sp->instructions(), ctx, $5,
} ctx->current_cursor_count());
i= new (lex->thd->mem_root) if (i == NULL || sp->add_instr(i) || ctx->add_cursor($2))
sp_instr_cpush(sp->instructions(), ctx, $5,
ctx->current_cursor_count());
if (i == NULL ||
sp->add_instr(i) ||
ctx->add_cursor($2))
MYSQL_YYABORT; MYSQL_YYABORT;
$$.vars= $$.conds= $$.hndlrs= 0; $$.vars= $$.conds= $$.hndlrs= 0;
$$.curs= 1; $$.curs= 1;
...@@ -3222,11 +3172,7 @@ sp_cursor_stmt: ...@@ -3222,11 +3172,7 @@ sp_cursor_stmt:
DBUG_ASSERT(lex->sql_command == SQLCOM_SELECT); DBUG_ASSERT(lex->sql_command == SQLCOM_SELECT);
if (lex->result) if (lex->result)
{ my_yyabort_error((ER_SP_BAD_CURSOR_SELECT, MYF(0)));
my_message(ER_SP_BAD_CURSOR_SELECT, ER_THD(thd, ER_SP_BAD_CURSOR_SELECT),
MYF(0));
MYSQL_YYABORT;
}
lex->sp_lex_in_use= TRUE; lex->sp_lex_in_use= TRUE;
$$= lex; $$= lex;
if (lex->sphead->restore_lex(thd)) if (lex->sphead->restore_lex(thd))
...@@ -3255,17 +3201,10 @@ sp_hcond_element: ...@@ -3255,17 +3201,10 @@ sp_hcond_element:
sp_pcontext *ctx= lex->spcont->parent_context(); sp_pcontext *ctx= lex->spcont->parent_context();
if (ctx->check_duplicate_handler($1)) if (ctx->check_duplicate_handler($1))
{ my_yyabort_error((ER_SP_DUP_HANDLER, MYF(0)));
my_message(ER_SP_DUP_HANDLER, ER_THD(thd, ER_SP_DUP_HANDLER), MYF(0));
MYSQL_YYABORT;
}
else
{
sp_instr_hpush_jump *i=
(sp_instr_hpush_jump *)sp->last_instruction();
i->add_condition($1); sp_instr_hpush_jump *i= (sp_instr_hpush_jump *)sp->last_instruction();
} i->add_condition($1);
} }
; ;
...@@ -3273,10 +3212,7 @@ sp_cond: ...@@ -3273,10 +3212,7 @@ sp_cond:
ulong_num ulong_num
{ /* mysql errno */ { /* mysql errno */
if ($1 == 0) if ($1 == 0)
{ my_yyabort_error((ER_WRONG_VALUE, MYF(0), "CONDITION", "0"));
my_error(ER_WRONG_VALUE, MYF(0), "CONDITION", "0");
MYSQL_YYABORT;
}
$$= new (thd->mem_root) sp_condition_value($1); $$= new (thd->mem_root) sp_condition_value($1);
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -3296,10 +3232,7 @@ sqlstate: ...@@ -3296,10 +3232,7 @@ sqlstate:
condition. condition.
*/ */
if (!is_sqlstate_valid(&$3) || is_sqlstate_completion($3.str)) if (!is_sqlstate_valid(&$3) || is_sqlstate_completion($3.str))
{ my_yyabort_error((ER_SP_BAD_SQLSTATE, MYF(0), $3.str));
my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
MYSQL_YYABORT;
}
$$= new (thd->mem_root) sp_condition_value($3.str); $$= new (thd->mem_root) sp_condition_value($3.str);
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -3320,10 +3253,7 @@ sp_hcond: ...@@ -3320,10 +3253,7 @@ sp_hcond:
{ {
$$= Lex->spcont->find_condition($1, false); $$= Lex->spcont->find_condition($1, false);
if ($$ == NULL) if ($$ == NULL)
{ my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
MYSQL_YYABORT;
}
} }
| SQLWARNING_SYM /* SQLSTATEs 01??? */ | SQLWARNING_SYM /* SQLSTATEs 01??? */
{ {
...@@ -3364,23 +3294,15 @@ signal_value: ...@@ -3364,23 +3294,15 @@ signal_value:
{ {
LEX *lex= Lex; LEX *lex= Lex;
sp_condition_value *cond; sp_condition_value *cond;
/* SIGNAL foo cannot be used outside of stored programs */
if (lex->spcont == NULL) if (lex->spcont == NULL)
{ my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
/* SIGNAL foo cannot be used outside of stored programs */
my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
MYSQL_YYABORT;
}
cond= lex->spcont->find_condition($1, false); cond= lex->spcont->find_condition($1, false);
if (cond == NULL) if (cond == NULL)
{ my_yyabort_error((ER_SP_COND_MISMATCH, MYF(0), $1.str));
my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
MYSQL_YYABORT;
}
if (cond->type != sp_condition_value::SQLSTATE) if (cond->type != sp_condition_value::SQLSTATE)
{ my_yyabort_error((ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0)));
my_error(ER_SIGNAL_BAD_CONDITION_TYPE, MYF(0));
MYSQL_YYABORT;
}
$$= cond; $$= cond;
} }
| sqlstate | sqlstate
...@@ -3418,11 +3340,8 @@ signal_information_item_list: ...@@ -3418,11 +3340,8 @@ signal_information_item_list:
info= &thd->m_parser_state->m_yacc.m_set_signal_info; info= &thd->m_parser_state->m_yacc.m_set_signal_info;
int index= (int) $3; int index= (int) $3;
if (info->m_item[index] != NULL) if (info->m_item[index] != NULL)
{ my_yyabort_error((ER_DUP_SIGNAL_SET, MYF(0),
my_error(ER_DUP_SIGNAL_SET, MYF(0), Diag_condition_item_names[index].str));
Diag_condition_item_names[index].str);
MYSQL_YYABORT;
}
info->m_item[index]= $5; info->m_item[index]= $5;
} }
; ;
...@@ -3653,10 +3572,7 @@ sp_decl_idents: ...@@ -3653,10 +3572,7 @@ sp_decl_idents:
sp_pcontext *spc= lex->spcont; sp_pcontext *spc= lex->spcont;
if (spc->find_variable($1, TRUE)) if (spc->find_variable($1, TRUE))
{ my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $1.str));
my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
MYSQL_YYABORT;
}
spc->add_variable(thd, $1); spc->add_variable(thd, $1);
$$= 1; $$= 1;
} }
...@@ -3668,10 +3584,7 @@ sp_decl_idents: ...@@ -3668,10 +3584,7 @@ sp_decl_idents:
sp_pcontext *spc= lex->spcont; sp_pcontext *spc= lex->spcont;
if (spc->find_variable($3, TRUE)) if (spc->find_variable($3, TRUE))
{ my_yyabort_error((ER_SP_DUP_VAR, MYF(0), $3.str));
my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
MYSQL_YYABORT;
}
spc->add_variable(thd, $3); spc->add_variable(thd, $3);
$$= $1 + 1; $$= $1 + 1;
} }
...@@ -3729,11 +3642,9 @@ sp_proc_stmt_statement: ...@@ -3729,11 +3642,9 @@ sp_proc_stmt_statement:
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
sp->m_flags|= sp_get_flags_for_command(lex); sp->m_flags|= sp_get_flags_for_command(lex);
/* "USE db" doesn't work in a procedure */
if (lex->sql_command == SQLCOM_CHANGE_DB) if (lex->sql_command == SQLCOM_CHANGE_DB)
{ /* "USE db" doesn't work in a procedure */ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "USE"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
MYSQL_YYABORT;
}
/* /*
Don't add an instruction for SET statements, since all Don't add an instruction for SET statements, since all
instructions for them were already added during processing instructions for them were already added during processing
...@@ -3743,7 +3654,7 @@ sp_proc_stmt_statement: ...@@ -3743,7 +3654,7 @@ sp_proc_stmt_statement:
lex->var_list.is_empty()); lex->var_list.is_empty());
if (lex->sql_command != SQLCOM_SET_OPTION) if (lex->sql_command != SQLCOM_SET_OPTION)
{ {
sp_instr_stmt *i=new (lex->thd->mem_root) sp_instr_stmt *i=new (thd->mem_root)
sp_instr_stmt(sp->instructions(), lex->spcont, lex); sp_instr_stmt(sp->instructions(), lex->spcont, lex);
if (i == NULL) if (i == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -3777,22 +3688,17 @@ sp_proc_stmt_return: ...@@ -3777,22 +3688,17 @@ sp_proc_stmt_return:
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
if (sp->m_type != TYPE_ENUM_FUNCTION) if (sp->m_type != TYPE_ENUM_FUNCTION)
{ my_yyabort_error((ER_SP_BADRETURN, MYF(0)));
my_message(ER_SP_BADRETURN, ER_THD(thd, ER_SP_BADRETURN), MYF(0));
MYSQL_YYABORT; sp_instr_freturn *i;
}
else
{
sp_instr_freturn *i;
i= new (lex->thd->mem_root) i= new (thd->mem_root)
sp_instr_freturn(sp->instructions(), lex->spcont, $3, sp_instr_freturn(sp->instructions(), lex->spcont, $3,
sp->m_return_field_def.sql_type, lex); sp->m_return_field_def.sql_type, lex);
if (i == NULL || if (i == NULL || sp->add_instr(i))
sp->add_instr(i)) MYSQL_YYABORT;
MYSQL_YYABORT; sp->m_flags|= sp_head::HAS_RETURN;
sp->m_flags|= sp_head::HAS_RETURN;
}
if (sp->restore_lex(thd)) if (sp->restore_lex(thd))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
...@@ -3807,49 +3713,44 @@ sp_proc_stmt_leave: ...@@ -3807,49 +3713,44 @@ sp_proc_stmt_leave:
sp_label *lab= ctx->find_label($2); sp_label *lab= ctx->find_label($2);
if (! lab) if (! lab)
my_yyabort_error((ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str));
sp_instr_jump *i;
uint ip= sp->instructions();
uint n;
/*
When jumping to a BEGIN-END block end, the target jump
points to the block hpop/cpop cleanup instructions,
so we should exclude the block context here.
When jumping to something else (i.e., SP_LAB_ITER),
there are no hpop/cpop at the jump destination,
so we should include the block context here for cleanup.
*/
bool exclusive= (lab->type == sp_label::BEGIN);
n= ctx->diff_handlers(lab->ctx, exclusive);
if (n)
{ {
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str); sp_instr_hpop *hpop= new (thd->mem_root)
MYSQL_YYABORT; sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL)
MYSQL_YYABORT;
sp->add_instr(hpop);
} }
else n= ctx->diff_cursors(lab->ctx, exclusive);
if (n)
{ {
sp_instr_jump *i; sp_instr_cpop *cpop= new (thd->mem_root)
uint ip= sp->instructions(); sp_instr_cpop(ip++, ctx, n);
uint n; if (cpop == NULL)
/*
When jumping to a BEGIN-END block end, the target jump
points to the block hpop/cpop cleanup instructions,
so we should exclude the block context here.
When jumping to something else (i.e., SP_LAB_ITER),
there are no hpop/cpop at the jump destination,
so we should include the block context here for cleanup.
*/
bool exclusive= (lab->type == sp_label::BEGIN);
n= ctx->diff_handlers(lab->ctx, exclusive);
if (n)
{
sp_instr_hpop *hpop= new (lex->thd->mem_root)
sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL)
MYSQL_YYABORT;
sp->add_instr(hpop);
}
n= ctx->diff_cursors(lab->ctx, exclusive);
if (n)
{
sp_instr_cpop *cpop= new (lex->thd->mem_root)
sp_instr_cpop(ip++, ctx, n);
if (cpop == NULL)
MYSQL_YYABORT;
sp->add_instr(cpop);
}
i= new (lex->thd->mem_root) sp_instr_jump(ip, ctx);
if (i == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
sp->push_backpatch(i, lab); /* Jumping forward */ sp->add_instr(cpop);
sp->add_instr(i);
} }
i= new (thd->mem_root) sp_instr_jump(ip, ctx);
if (i == NULL)
MYSQL_YYABORT;
sp->push_backpatch(i, lab); /* Jumping forward */
sp->add_instr(i);
} }
; ;
...@@ -3862,40 +3763,35 @@ sp_proc_stmt_iterate: ...@@ -3862,40 +3763,35 @@ sp_proc_stmt_iterate:
sp_label *lab= ctx->find_label($2); sp_label *lab= ctx->find_label($2);
if (! lab || lab->type != sp_label::ITERATION) if (! lab || lab->type != sp_label::ITERATION)
my_yyabort_error((ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str));
sp_instr_jump *i;
uint ip= sp->instructions();
uint n;
n= ctx->diff_handlers(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
{ {
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str); sp_instr_hpop *hpop= new (thd->mem_root)
MYSQL_YYABORT; sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL ||
sp->add_instr(hpop))
MYSQL_YYABORT;
} }
else n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
{ {
sp_instr_jump *i; sp_instr_cpop *cpop= new (thd->mem_root)
uint ip= sp->instructions(); sp_instr_cpop(ip++, ctx, n);
uint n; if (cpop == NULL ||
sp->add_instr(cpop))
n= ctx->diff_handlers(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
{
sp_instr_hpop *hpop= new (lex->thd->mem_root)
sp_instr_hpop(ip++, ctx, n);
if (hpop == NULL ||
sp->add_instr(hpop))
MYSQL_YYABORT;
}
n= ctx->diff_cursors(lab->ctx, FALSE); /* Inclusive the dest. */
if (n)
{
sp_instr_cpop *cpop= new (lex->thd->mem_root)
sp_instr_cpop(ip++, ctx, n);
if (cpop == NULL ||
sp->add_instr(cpop))
MYSQL_YYABORT;
}
i= new (lex->thd->mem_root)
sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
i= new (thd->mem_root)
sp_instr_jump(ip, ctx, lab->ip); /* Jump back */
if (i == NULL ||
sp->add_instr(i))
MYSQL_YYABORT;
} }
; ;
...@@ -3908,11 +3804,8 @@ sp_proc_stmt_open: ...@@ -3908,11 +3804,8 @@ sp_proc_stmt_open:
sp_instr_copen *i; sp_instr_copen *i;
if (! lex->spcont->find_cursor($2, &offset, false)) if (! lex->spcont->find_cursor($2, &offset, false))
{ my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $2.str));
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str); i= new (thd->mem_root)
MYSQL_YYABORT;
}
i= new (lex->thd->mem_root)
sp_instr_copen(sp->instructions(), lex->spcont, offset); sp_instr_copen(sp->instructions(), lex->spcont, offset);
if (i == NULL || if (i == NULL ||
sp->add_instr(i)) sp->add_instr(i))
...@@ -3929,11 +3822,8 @@ sp_proc_stmt_fetch: ...@@ -3929,11 +3822,8 @@ sp_proc_stmt_fetch:
sp_instr_cfetch *i; sp_instr_cfetch *i;
if (! lex->spcont->find_cursor($3, &offset, false)) if (! lex->spcont->find_cursor($3, &offset, false))
{ my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $3.str));
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str); i= new (thd->mem_root)
MYSQL_YYABORT;
}
i= new (lex->thd->mem_root)
sp_instr_cfetch(sp->instructions(), lex->spcont, offset); sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
if (i == NULL || if (i == NULL ||
sp->add_instr(i)) sp->add_instr(i))
...@@ -3952,11 +3842,8 @@ sp_proc_stmt_close: ...@@ -3952,11 +3842,8 @@ sp_proc_stmt_close:
sp_instr_cclose *i; sp_instr_cclose *i;
if (! lex->spcont->find_cursor($2, &offset, false)) if (! lex->spcont->find_cursor($2, &offset, false))
{ my_yyabort_error((ER_SP_CURSOR_MISMATCH, MYF(0), $2.str));
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str); i= new (thd->mem_root)
MYSQL_YYABORT;
}
i= new (lex->thd->mem_root)
sp_instr_cclose(sp->instructions(), lex->spcont, offset); sp_instr_cclose(sp->instructions(), lex->spcont, offset);
if (i == NULL || if (i == NULL ||
sp->add_instr(i)) sp->add_instr(i))
...@@ -3979,17 +3866,11 @@ sp_fetch_list: ...@@ -3979,17 +3866,11 @@ sp_fetch_list:
sp_variable *spv; sp_variable *spv;
if (!spc || !(spv = spc->find_variable($1, false))) if (!spc || !(spv = spc->find_variable($1, false)))
{ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
MYSQL_YYABORT;
}
else
{
/* An SP local variable */
sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
i->add_to_varlist(spv); /* An SP local variable */
} sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
i->add_to_varlist(spv);
} }
| sp_fetch_list ',' ident | sp_fetch_list ',' ident
{ {
...@@ -3999,17 +3880,11 @@ sp_fetch_list: ...@@ -3999,17 +3880,11 @@ sp_fetch_list:
sp_variable *spv; sp_variable *spv;
if (!spc || !(spv = spc->find_variable($3, false))) if (!spc || !(spv = spc->find_variable($3, false)))
{ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $3.str));
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
MYSQL_YYABORT;
}
else
{
/* An SP local variable */
sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
i->add_to_varlist(spv); /* An SP local variable */
} sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
i->add_to_varlist(spv);
} }
; ;
...@@ -4021,7 +3896,7 @@ sp_if: ...@@ -4021,7 +3896,7 @@ sp_if:
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
sp_pcontext *ctx= lex->spcont; sp_pcontext *ctx= lex->spcont;
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump_if_not *i= new (lex->thd->mem_root) sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, ctx, $2, lex); sp_instr_jump_if_not(ip, ctx, $2, lex);
if (i == NULL || if (i == NULL ||
sp->push_backpatch(i, ctx->push_label(thd, empty_lex_str, 0)) || sp->push_backpatch(i, ctx->push_label(thd, empty_lex_str, 0)) ||
...@@ -4229,10 +4104,7 @@ sp_labeled_block: ...@@ -4229,10 +4104,7 @@ sp_labeled_block:
sp_label *lab= ctx->find_label($1); sp_label *lab= ctx->find_label($1);
if (lab) if (lab)
{ my_yyabort_error((ER_SP_LABEL_REDEFINE, MYF(0), $1.str));
my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
MYSQL_YYABORT;
}
lex->name= $1; lex->name= $1;
} }
sp_block_content sp_opt_label sp_block_content sp_opt_label
...@@ -4240,10 +4112,7 @@ sp_labeled_block: ...@@ -4240,10 +4112,7 @@ sp_labeled_block:
if ($6.str) if ($6.str)
{ {
if (my_strcasecmp(system_charset_info, $6.str, $5->name.str) != 0) if (my_strcasecmp(system_charset_info, $6.str, $5->name.str) != 0)
{ my_yyabort_error((ER_SP_LABEL_MISMATCH, MYF(0), $6.str));
my_error(ER_SP_LABEL_MISMATCH, MYF(0), $6.str);
MYSQL_YYABORT;
}
} }
} }
; ;
...@@ -4297,7 +4166,7 @@ sp_block_content: ...@@ -4297,7 +4166,7 @@ sp_block_content:
} }
if ($2.curs) if ($2.curs)
{ {
i= new (lex->thd->mem_root) i= new (thd->mem_root)
sp_instr_cpop(sp->instructions(), ctx, $2.curs); sp_instr_cpop(sp->instructions(), ctx, $2.curs);
if (i == NULL || if (i == NULL ||
sp->add_instr(i)) sp->add_instr(i))
...@@ -4314,7 +4183,7 @@ loop_body: ...@@ -4314,7 +4183,7 @@ loop_body:
LEX *lex= Lex; LEX *lex= Lex;
uint ip= lex->sphead->instructions(); uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */ sp_label *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump *i= new (lex->thd->mem_root) sp_instr_jump *i= new (thd->mem_root)
sp_instr_jump(ip, lex->spcont, lab->ip); sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL || if (i == NULL ||
lex->sphead->add_instr(i)) lex->sphead->add_instr(i))
...@@ -4328,7 +4197,7 @@ while_body: ...@@ -4328,7 +4197,7 @@ while_body:
LEX *lex= Lex; LEX *lex= Lex;
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
uint ip= sp->instructions(); uint ip= sp->instructions();
sp_instr_jump_if_not *i= new (lex->thd->mem_root) sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, lex->spcont, $1, lex); sp_instr_jump_if_not(ip, lex->spcont, $1, lex);
if (i == NULL || if (i == NULL ||
/* Jumping forward */ /* Jumping forward */
...@@ -4344,7 +4213,7 @@ while_body: ...@@ -4344,7 +4213,7 @@ while_body:
LEX *lex= Lex; LEX *lex= Lex;
uint ip= lex->sphead->instructions(); uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */ sp_label *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump *i= new (lex->thd->mem_root) sp_instr_jump *i= new (thd->mem_root)
sp_instr_jump(ip, lex->spcont, lab->ip); sp_instr_jump(ip, lex->spcont, lab->ip);
if (i == NULL || if (i == NULL ||
lex->sphead->add_instr(i)) lex->sphead->add_instr(i))
...@@ -4361,7 +4230,7 @@ repeat_body: ...@@ -4361,7 +4230,7 @@ repeat_body:
LEX *lex= Lex; LEX *lex= Lex;
uint ip= lex->sphead->instructions(); uint ip= lex->sphead->instructions();
sp_label *lab= lex->spcont->last_label(); /* Jumping back */ sp_label *lab= lex->spcont->last_label(); /* Jumping back */
sp_instr_jump_if_not *i= new (lex->thd->mem_root) sp_instr_jump_if_not *i= new (thd->mem_root)
sp_instr_jump_if_not(ip, lex->spcont, $4, lab->ip, lex); sp_instr_jump_if_not(ip, lex->spcont, $4, lab->ip, lex);
if (i == NULL || if (i == NULL ||
lex->sphead->add_instr(i)) lex->sphead->add_instr(i))
...@@ -4382,10 +4251,7 @@ pop_sp_label: ...@@ -4382,10 +4251,7 @@ pop_sp_label:
{ {
if (my_strcasecmp(system_charset_info, $1.str, if (my_strcasecmp(system_charset_info, $1.str,
lab->name.str) != 0) lab->name.str) != 0)
{ my_yyabort_error((ER_SP_LABEL_MISMATCH, MYF(0), $1.str));
my_error(ER_SP_LABEL_MISMATCH, MYF(0), $1.str);
MYSQL_YYABORT;
}
} }
} }
; ;
...@@ -4752,10 +4618,7 @@ opt_ts_nodegroup: ...@@ -4752,10 +4618,7 @@ opt_ts_nodegroup:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->alter_tablespace_info->nodegroup_id != UNDEF_NODEGROUP) if (lex->alter_tablespace_info->nodegroup_id != UNDEF_NODEGROUP)
{ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NODEGROUP"));
my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NODEGROUP");
MYSQL_YYABORT;
}
lex->alter_tablespace_info->nodegroup_id= $3; lex->alter_tablespace_info->nodegroup_id= $3;
} }
; ;
...@@ -4765,10 +4628,7 @@ opt_ts_comment: ...@@ -4765,10 +4628,7 @@ opt_ts_comment:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->alter_tablespace_info->ts_comment != NULL) if (lex->alter_tablespace_info->ts_comment != NULL)
{ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"COMMENT"));
my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"COMMENT");
MYSQL_YYABORT;
}
lex->alter_tablespace_info->ts_comment= $3.str; lex->alter_tablespace_info->ts_comment= $3.str;
} }
; ;
...@@ -4778,11 +4638,8 @@ opt_ts_engine: ...@@ -4778,11 +4638,8 @@ opt_ts_engine:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->alter_tablespace_info->storage_engine != NULL) if (lex->alter_tablespace_info->storage_engine != NULL)
{ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE, MYF(0),
my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0), "STORAGE ENGINE"));
"STORAGE ENGINE");
MYSQL_YYABORT;
}
lex->alter_tablespace_info->storage_engine= $4; lex->alter_tablespace_info->storage_engine= $4;
} }
; ;
...@@ -4802,10 +4659,7 @@ ts_wait: ...@@ -4802,10 +4659,7 @@ ts_wait:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (!(lex->alter_tablespace_info->wait_until_completed)) if (!(lex->alter_tablespace_info->wait_until_completed))
{ my_yyabort_error((ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NO_WAIT"));
my_error(ER_FILEGROUP_OPTION_ONLY_ONCE,MYF(0),"NO_WAIT");
MYSQL_YYABORT;
}
lex->alter_tablespace_info->wait_until_completed= FALSE; lex->alter_tablespace_info->wait_until_completed= FALSE;
} }
; ;
...@@ -4837,23 +4691,14 @@ size_number: ...@@ -4837,23 +4691,14 @@ size_number:
text_shift_number+=10; text_shift_number+=10;
break; break;
default: default:
{ my_yyabort_error((ER_WRONG_SIZE_NUMBER, MYF(0)));
my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
MYSQL_YYABORT;
}
} }
if (prefix_number >> 31) if (prefix_number >> 31)
{ my_yyabort_error((ER_SIZE_OVERFLOW_ERROR, MYF(0)));
my_error(ER_SIZE_OVERFLOW_ERROR, MYF(0));
MYSQL_YYABORT;
}
number= prefix_number << text_shift_number; number= prefix_number << text_shift_number;
} }
else else
{ my_yyabort_error((ER_WRONG_SIZE_NUMBER, MYF(0)));
my_error(ER_WRONG_SIZE_NUMBER, MYF(0));
MYSQL_YYABORT;
}
$$= number; $$= number;
} }
; ;
...@@ -4967,15 +4812,11 @@ have_partitioning: ...@@ -4967,15 +4812,11 @@ have_partitioning:
#ifdef WITH_PARTITION_STORAGE_ENGINE #ifdef WITH_PARTITION_STORAGE_ENGINE
LEX_STRING partition_name={C_STRING_WITH_LEN("partition")}; LEX_STRING partition_name={C_STRING_WITH_LEN("partition")};
if (!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN)) if (!plugin_is_ready(&partition_name, MYSQL_STORAGE_ENGINE_PLUGIN))
{ my_yyabort_error((ER_OPTION_PREVENTS_STATEMENT, MYF(0),
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-partition"));
"--skip-partition");
MYSQL_YYABORT;
}
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), "partitioning", my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), "partitioning",
"--with-plugin-partition"); "--with-plugin-partition"));
MYSQL_YYABORT;
#endif #endif
} }
; ;
...@@ -5068,11 +4909,8 @@ part_field_item: ...@@ -5068,11 +4909,8 @@ part_field_item:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (part_info->num_columns > MAX_REF_PARTS) if (part_info->num_columns > MAX_REF_PARTS)
{ my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), "list of partition fields"));
"list of partition fields");
MYSQL_YYABORT;
}
} }
; ;
...@@ -5113,10 +4951,7 @@ opt_num_parts: ...@@ -5113,10 +4951,7 @@ opt_num_parts:
uint num_parts= $2; uint num_parts= $2;
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (num_parts == 0) if (num_parts == 0)
{ my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "partitions"));
my_error(ER_NO_PARTS_ERROR, MYF(0), "partitions");
MYSQL_YYABORT;
}
part_info->num_parts= num_parts; part_info->num_parts= num_parts;
part_info->use_default_num_partitions= FALSE; part_info->use_default_num_partitions= FALSE;
...@@ -5153,11 +4988,8 @@ sub_part_field_item: ...@@ -5153,11 +4988,8 @@ sub_part_field_item:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (part_info->subpart_field_list.elements > MAX_REF_PARTS) if (part_info->subpart_field_list.elements > MAX_REF_PARTS)
{ my_yyabort_error((ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0),
my_error(ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR, MYF(0), "list of subpartition fields"));
"list of subpartition fields");
MYSQL_YYABORT;
}
} }
; ;
...@@ -5184,10 +5016,7 @@ opt_num_subparts: ...@@ -5184,10 +5016,7 @@ opt_num_subparts:
uint num_parts= $2; uint num_parts= $2;
LEX *lex= Lex; LEX *lex= Lex;
if (num_parts == 0) if (num_parts == 0)
{ my_yyabort_error((ER_NO_PARTS_ERROR, MYF(0), "subpartitions"));
my_error(ER_NO_PARTS_ERROR, MYF(0), "subpartitions");
MYSQL_YYABORT;
}
lex->part_info->num_subparts= num_parts; lex->part_info->num_subparts= num_parts;
lex->part_info->use_default_num_subpartitions= FALSE; lex->part_info->use_default_num_subpartitions= FALSE;
} }
...@@ -5198,17 +5027,11 @@ part_defs: ...@@ -5198,17 +5027,11 @@ part_defs:
{ {
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (part_info->part_type == RANGE_PARTITION) if (part_info->part_type == RANGE_PARTITION)
{ my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0), "RANGE"));
"RANGE"); if (part_info->part_type == LIST_PARTITION)
MYSQL_YYABORT; my_yyabort_error((ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
} "LIST"));
else if (part_info->part_type == LIST_PARTITION)
{
my_error(ER_PARTITIONS_MUST_BE_DEFINED_ERROR, MYF(0),
"LIST");
MYSQL_YYABORT;
}
} }
| '(' part_def_list ')' | '(' part_def_list ')'
{ {
...@@ -5278,17 +5101,11 @@ opt_part_values: ...@@ -5278,17 +5101,11 @@ opt_part_values:
if (! lex->is_partition_management()) if (! lex->is_partition_management())
{ {
if (part_info->part_type == RANGE_PARTITION) if (part_info->part_type == RANGE_PARTITION)
{ my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "RANGE", "LESS THAN"));
"RANGE", "LESS THAN");
MYSQL_YYABORT;
}
if (part_info->part_type == LIST_PARTITION) if (part_info->part_type == LIST_PARTITION)
{ my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "LIST", "IN"));
"LIST", "IN");
MYSQL_YYABORT;
}
} }
else else
part_info->part_type= HASH_PARTITION; part_info->part_type= HASH_PARTITION;
...@@ -5300,11 +5117,8 @@ opt_part_values: ...@@ -5300,11 +5117,8 @@ opt_part_values:
if (! lex->is_partition_management()) if (! lex->is_partition_management())
{ {
if (part_info->part_type != RANGE_PARTITION) if (part_info->part_type != RANGE_PARTITION)
{ my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), "RANGE", "LESS THAN"));
"RANGE", "LESS THAN");
MYSQL_YYABORT;
}
} }
else else
part_info->part_type= RANGE_PARTITION; part_info->part_type= RANGE_PARTITION;
...@@ -5317,11 +5131,8 @@ opt_part_values: ...@@ -5317,11 +5131,8 @@ opt_part_values:
if (! lex->is_partition_management()) if (! lex->is_partition_management())
{ {
if (part_info->part_type != LIST_PARTITION) if (part_info->part_type != LIST_PARTITION)
{ my_yyabort_error((ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0), "LIST", "IN"));
"LIST", "IN");
MYSQL_YYABORT;
}
} }
else else
part_info->part_type= LIST_PARTITION; part_info->part_type= LIST_PARTITION;
...@@ -5979,10 +5790,7 @@ storage_engines: ...@@ -5979,10 +5790,7 @@ storage_engines:
else else
{ {
if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
{ my_yyabort_error((ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str));
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
MYSQL_YYABORT;
}
$$= 0; $$= 0;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_UNKNOWN_STORAGE_ENGINE, ER_UNKNOWN_STORAGE_ENGINE,
...@@ -5999,10 +5807,7 @@ known_storage_engines: ...@@ -5999,10 +5807,7 @@ known_storage_engines:
if ((plugin= ha_resolve_by_name(thd, &$1, false))) if ((plugin= ha_resolve_by_name(thd, &$1, false)))
$$= plugin_hton(plugin); $$= plugin_hton(plugin);
else else
{ my_yyabort_error((ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str));
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
MYSQL_YYABORT;
}
} }
; ;
...@@ -6162,10 +5967,7 @@ field_spec: ...@@ -6162,10 +5967,7 @@ field_spec:
if (check_string_char_length(&$1, 0, NAME_CHAR_LEN, if (check_string_char_length(&$1, 0, NAME_CHAR_LEN,
system_charset_info, 1)) system_charset_info, 1))
{ my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str));
my_error(ER_TOO_LONG_IDENT, MYF(0), $1.str);
MYSQL_YYABORT;
}
if (!f) if (!f)
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -6252,10 +6054,7 @@ parse_vcol_expr: ...@@ -6252,10 +6054,7 @@ parse_vcol_expr:
Prevent the end user from invoking this command. Prevent the end user from invoking this command.
*/ */
if (!Lex->parse_vcol_expr) if (!Lex->parse_vcol_expr)
{ my_yyabort_error((ER_SYNTAX_ERROR, MYF(0)));
my_message(ER_SYNTAX_ERROR, ER_THD(thd, ER_SYNTAX_ERROR), MYF(0));
MYSQL_YYABORT;
}
} }
; ;
...@@ -6287,12 +6086,9 @@ field_type: ...@@ -6287,12 +6086,9 @@ field_type:
int err; int err;
ulonglong tmp_length= my_strtoll10(Lex->length, NULL, &err); ulonglong tmp_length= my_strtoll10(Lex->length, NULL, &err);
if (err || tmp_length > PRECISION_FOR_DOUBLE) if (err || tmp_length > PRECISION_FOR_DOUBLE)
{ my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
my_error(ER_WRONG_FIELD_SPEC, MYF(0), Lex->last_field->field_name));
Lex->last_field->field_name); if (tmp_length > PRECISION_FOR_FLOAT)
MYSQL_YYABORT;
}
else if (tmp_length > PRECISION_FOR_FLOAT)
$$= MYSQL_TYPE_DOUBLE; $$= MYSQL_TYPE_DOUBLE;
Lex->length= 0; Lex->length= 0;
} }
...@@ -6421,9 +6217,8 @@ field_type: ...@@ -6421,9 +6217,8 @@ field_type:
Lex->last_field->geom_type= $1; Lex->last_field->geom_type= $1;
$$=MYSQL_TYPE_GEOMETRY; $$=MYSQL_TYPE_GEOMETRY;
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.needed_define));
MYSQL_YYABORT;
#endif #endif
} }
| MEDIUMBLOB | MEDIUMBLOB
...@@ -6639,15 +6434,9 @@ attribute: ...@@ -6639,15 +6434,9 @@ attribute:
| COLLATE_SYM collation_name | COLLATE_SYM collation_name
{ {
if (Lex->charset && !my_charset_same(Lex->charset,$2)) if (Lex->charset && !my_charset_same(Lex->charset,$2))
{ my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), $2->name,Lex->charset->csname));
$2->name,Lex->charset->csname); Lex->last_field->charset= $2;
MYSQL_YYABORT;
}
else
{
Lex->last_field->charset= $2;
}
} }
| IDENT_sys equal TEXT_STRING_sys | IDENT_sys equal TEXT_STRING_sys
{ {
...@@ -6710,10 +6499,7 @@ charset_name: ...@@ -6710,10 +6499,7 @@ charset_name:
ident_or_text ident_or_text
{ {
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0)))) if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
{ my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str));
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
MYSQL_YYABORT;
}
} }
| BINARY { $$= &my_charset_bin; } | BINARY { $$= &my_charset_bin; }
; ;
...@@ -6733,10 +6519,7 @@ old_or_new_charset_name: ...@@ -6733,10 +6519,7 @@ old_or_new_charset_name:
{ {
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) && if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
!($$=get_old_charset_by_name($1.str))) !($$=get_old_charset_by_name($1.str)))
{ my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str));
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
MYSQL_YYABORT;
}
} }
| BINARY { $$= &my_charset_bin; } | BINARY { $$= &my_charset_bin; }
; ;
...@@ -6775,10 +6558,7 @@ charset_or_alias: ...@@ -6775,10 +6558,7 @@ charset_or_alias:
| UNICODE_SYM | UNICODE_SYM
{ {
if (!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0)))) if (!($$= get_charset_by_csname("ucs2", MY_CS_PRIMARY,MYF(0))))
{ my_yyabort_error((ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2"));
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
MYSQL_YYABORT;
}
} }
; ;
...@@ -6994,9 +6774,8 @@ spatial: ...@@ -6994,9 +6774,8 @@ spatial:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= Key::SPATIAL; $$= Key::SPATIAL;
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.needed_define));
MYSQL_YYABORT;
#endif #endif
} }
; ;
...@@ -7094,10 +6873,7 @@ fulltext_key_opt: ...@@ -7094,10 +6873,7 @@ fulltext_key_opt:
if (plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN)) if (plugin_is_ready(&$3, MYSQL_FTPARSER_PLUGIN))
Lex->last_key->key_create_info.parser_name= $3; Lex->last_key->key_create_info.parser_name= $3;
else else
{ my_yyabort_error((ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str));
my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), $3.str);
MYSQL_YYABORT;
}
} }
; ;
...@@ -7129,9 +6905,7 @@ key_part: ...@@ -7129,9 +6905,7 @@ key_part:
{ {
int key_part_len= atoi($3.str); int key_part_len= atoi($3.str);
if (!key_part_len) if (!key_part_len)
{ my_yyabort_error((ER_KEY_PART_0, MYF(0), $1.str));
my_error(ER_KEY_PART_0, MYF(0), $1.str);
}
$$= new (thd->mem_root) Key_part_spec($1, (uint) key_part_len); $$= new (thd->mem_root) Key_part_spec($1, (uint) key_part_len);
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -7211,10 +6985,7 @@ alter: ...@@ -7211,10 +6985,7 @@ alter:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "DATABASE"));
my_error(ER_SP_NO_DROP_SP, MYF(0), "DATABASE");
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_ALTER_DB_UPGRADE; lex->sql_command= SQLCOM_ALTER_DB_UPGRADE;
lex->name= $3; lex->name= $3;
} }
...@@ -7223,10 +6994,7 @@ alter: ...@@ -7223,10 +6994,7 @@ alter:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
MYSQL_YYABORT;
}
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
} }
sp_a_chistics sp_a_chistics
...@@ -7241,10 +7009,7 @@ alter: ...@@ -7241,10 +7009,7 @@ alter:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
MYSQL_YYABORT;
}
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
} }
sp_a_chistics sp_a_chistics
...@@ -7259,10 +7024,7 @@ alter: ...@@ -7259,10 +7024,7 @@ alter:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
MYSQL_YYABORT;
}
lex->create_view_mode= VIEW_ALTER; lex->create_view_mode= VIEW_ALTER;
} }
view_tail view_tail
...@@ -7277,10 +7039,7 @@ alter: ...@@ -7277,10 +7039,7 @@ alter:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW");
MYSQL_YYABORT;
}
lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT; lex->create_view_algorithm= VIEW_ALGORITHM_INHERIT;
lex->create_view_mode= VIEW_ALTER; lex->create_view_mode= VIEW_ALTER;
} }
...@@ -7743,10 +7502,7 @@ alter_list_item: ...@@ -7743,10 +7502,7 @@ alter_list_item:
} }
if (check_table_name($3->table.str,$3->table.length, FALSE) || if (check_table_name($3->table.str,$3->table.length, FALSE) ||
($3->db.str && check_db_name(&$3->db))) ($3->db.str && check_db_name(&$3->db)))
{ my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3->table.str));
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
MYSQL_YYABORT;
}
lex->name= $3->table; lex->name= $3->table;
lex->alter_info.flags|= Alter_info::ALTER_RENAME; lex->alter_info.flags|= Alter_info::ALTER_RENAME;
} }
...@@ -7758,15 +7514,11 @@ alter_list_item: ...@@ -7758,15 +7514,11 @@ alter_list_item:
} }
$5= $5 ? $5 : $4; $5= $5 ? $5 : $4;
if (!my_charset_same($4,$5)) if (!my_charset_same($4,$5))
{ my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0),
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), $5->name, $4->csname));
$5->name, $4->csname); if (Lex->create_info.add_alter_list_item_convert_to_charset($5))
MYSQL_YYABORT; MYSQL_YYABORT;
} Lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
LEX *lex= Lex;
if (lex->create_info.add_alter_list_item_convert_to_charset($5))
MYSQL_YYABORT;
lex->alter_info.flags|= Alter_info::ALTER_CONVERT;
} }
| create_table_options_space_separated | create_table_options_space_separated
{ {
...@@ -7807,10 +7559,7 @@ alter_algorithm_option: ...@@ -7807,10 +7559,7 @@ alter_algorithm_option:
| ALGORITHM_SYM opt_equal ident | ALGORITHM_SYM opt_equal ident
{ {
if (Lex->alter_info.set_requested_algorithm(&$3)) if (Lex->alter_info.set_requested_algorithm(&$3))
{ my_yyabort_error((ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $3.str));
my_error(ER_UNKNOWN_ALTER_ALGORITHM, MYF(0), $3.str);
MYSQL_YYABORT;
}
} }
; ;
...@@ -7823,10 +7572,7 @@ alter_lock_option: ...@@ -7823,10 +7572,7 @@ alter_lock_option:
| LOCK_SYM opt_equal ident | LOCK_SYM opt_equal ident
{ {
if (Lex->alter_info.set_requested_lock(&$3)) if (Lex->alter_info.set_requested_lock(&$3))
{ my_yyabort_error((ER_UNKNOWN_ALTER_LOCK, MYF(0), $3.str));
my_error(ER_UNKNOWN_ALTER_LOCK, MYF(0), $3.str);
MYSQL_YYABORT;
}
} }
; ;
...@@ -8002,11 +7748,7 @@ slave_until: ...@@ -8002,11 +7748,7 @@ slave_until:
(lex->mi.relay_log_name || lex->mi.relay_log_pos)) || (lex->mi.relay_log_name || lex->mi.relay_log_pos)) ||
!((lex->mi.log_file_name && lex->mi.pos) || !((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos))) (lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{ my_yyabort_error((ER_BAD_SLAVE_UNTIL_COND, MYF(0)));
my_message(ER_BAD_SLAVE_UNTIL_COND,
ER_THD(thd, ER_BAD_SLAVE_UNTIL_COND), MYF(0));
MYSQL_YYABORT;
}
} }
| UNTIL_SYM MASTER_GTID_POS_SYM EQ TEXT_STRING_sys | UNTIL_SYM MASTER_GTID_POS_SYM EQ TEXT_STRING_sys
{ {
...@@ -8221,10 +7963,7 @@ check: CHECK_SYM ...@@ -8221,10 +7963,7 @@ check: CHECK_SYM
{ {
LEX* lex= thd->lex; LEX* lex= thd->lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "CHECK"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
MYSQL_YYABORT;
}
DBUG_ASSERT(!lex->m_sql_cmd); DBUG_ASSERT(!lex->m_sql_cmd);
lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_check_table(); lex->m_sql_cmd= new (thd->mem_root) Sql_cmd_check_table();
if (lex->m_sql_cmd == NULL) if (lex->m_sql_cmd == NULL)
...@@ -8321,9 +8060,9 @@ table_to_table: ...@@ -8321,9 +8060,9 @@ table_to_table:
{ {
LEX *lex=Lex; LEX *lex=Lex;
SELECT_LEX *sl= lex->current_select; SELECT_LEX *sl= lex->current_select;
if (!sl->add_table_to_list(lex->thd, $1,NULL,TL_OPTION_UPDATING, if (!sl->add_table_to_list(thd, $1,NULL,TL_OPTION_UPDATING,
TL_IGNORE, MDL_EXCLUSIVE) || TL_IGNORE, MDL_EXCLUSIVE) ||
!sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING, !sl->add_table_to_list(thd, $3,NULL,TL_OPTION_UPDATING,
TL_IGNORE, MDL_EXCLUSIVE)) TL_IGNORE, MDL_EXCLUSIVE))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
...@@ -8528,18 +8267,11 @@ select_part2: ...@@ -8528,18 +8267,11 @@ select_part2:
opt_into opt_into
opt_select_lock_type opt_select_lock_type
{ {
if ($2 && $10) if ($2 && $10) /* double "INTO" clause */
{ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "INTO", "INTO"));
/* double "INTO" clause */
my_error(ER_WRONG_USAGE, MYF(0), "INTO", "INTO"); if ($9 && ($2 || $10)) /* "INTO" with "PROCEDURE ANALYSE" */
MYSQL_YYABORT; my_yyabort_error((ER_WRONG_USAGE, MYF(0), "PROCEDURE", "INTO"));
}
if ($9 && ($2 || $10))
{
/* "INTO" with "PROCEDURE ANALYSE" */
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "INTO");
MYSQL_YYABORT;
}
} }
; ;
...@@ -8596,10 +8328,7 @@ select_options: ...@@ -8596,10 +8328,7 @@ select_options:
| select_option_list | select_option_list
{ {
if (Select->options & SELECT_DISTINCT && Select->options & SELECT_ALL) if (Select->options & SELECT_DISTINCT && Select->options & SELECT_ALL)
{ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"));
my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT");
MYSQL_YYABORT;
}
} }
; ;
...@@ -8617,26 +8346,15 @@ select_option: ...@@ -8617,26 +8346,15 @@ select_option:
SQL_CACHE wasn't specified, and only once per query. SQL_CACHE wasn't specified, and only once per query.
*/ */
if (Lex->current_select != &Lex->select_lex) if (Lex->current_select != &Lex->select_lex)
{ my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_NO_CACHE"));
my_error(ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_NO_CACHE"); if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
MYSQL_YYABORT; my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_CACHE", "SQL_NO_CACHE"));
} if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE) my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_NO_CACHE"));
{
my_error(ER_WRONG_USAGE, MYF(0), "SQL_CACHE", "SQL_NO_CACHE"); Lex->safe_to_cache_query=0;
MYSQL_YYABORT; Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE;
} Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE;
else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
{
my_error(ER_DUP_ARGUMENT, MYF(0), "SQL_NO_CACHE");
MYSQL_YYABORT;
}
else
{
Lex->safe_to_cache_query=0;
Lex->select_lex.options&= ~OPTION_TO_QUERY_CACHE;
Lex->select_lex.sql_cache= SELECT_LEX::SQL_NO_CACHE;
}
} }
| SQL_CACHE_SYM | SQL_CACHE_SYM
{ {
...@@ -8645,26 +8363,15 @@ select_option: ...@@ -8645,26 +8363,15 @@ select_option:
SQL_NO_CACHE wasn't specified, and only once per query. SQL_NO_CACHE wasn't specified, and only once per query.
*/ */
if (Lex->current_select != &Lex->select_lex) if (Lex->current_select != &Lex->select_lex)
{ my_yyabort_error((ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_CACHE"));
my_error(ER_CANT_USE_OPTION_HERE, MYF(0), "SQL_CACHE"); if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE)
MYSQL_YYABORT; my_yyabort_error((ER_WRONG_USAGE, MYF(0), "SQL_NO_CACHE", "SQL_CACHE"));
} if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_NO_CACHE) my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SQL_CACHE"));
{
my_error(ER_WRONG_USAGE, MYF(0), "SQL_NO_CACHE", "SQL_CACHE"); Lex->safe_to_cache_query=1;
MYSQL_YYABORT; Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
} Lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE;
else if (Lex->select_lex.sql_cache == SELECT_LEX::SQL_CACHE)
{
my_error(ER_DUP_ARGUMENT, MYF(0), "SQL_CACHE");
MYSQL_YYABORT;
}
else
{
Lex->safe_to_cache_query=1;
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
Lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE;
}
} }
; ;
...@@ -8717,10 +8424,7 @@ select_item: ...@@ -8717,10 +8424,7 @@ select_item:
{ {
if (Lex->sql_command == SQLCOM_CREATE_VIEW && if (Lex->sql_command == SQLCOM_CREATE_VIEW &&
check_column_name($4.str)) check_column_name($4.str))
{ my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), $4.str));
my_error(ER_WRONG_COLUMN_NAME, MYF(0), $4.str);
MYSQL_YYABORT;
}
$2->is_autogenerated_name= FALSE; $2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info); $2->set_name($4.str, $4.length, system_charset_info);
} }
...@@ -9462,11 +9166,7 @@ simple_expr: ...@@ -9462,11 +9166,7 @@ simple_expr:
{ {
Item_splocal *il= $3->get_item_splocal(); Item_splocal *il= $3->get_item_splocal();
if (il) if (il)
{ my_yyabort_error((ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str));
my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
MYSQL_YYABORT;
}
$$= new (thd->mem_root) Item_default_value(thd, Lex->current_context(), $$= new (thd->mem_root) Item_default_value(thd, Lex->current_context(),
$3); $3);
if ($$ == NULL) if ($$ == NULL)
...@@ -10082,9 +9782,8 @@ function_call_conflict: ...@@ -10082,9 +9782,8 @@ function_call_conflict:
if ($$ == NULL) if ($$ == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name,
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.needed_define));
MYSQL_YYABORT;
#endif #endif
} }
; ;
...@@ -10246,10 +9945,7 @@ function_call_generic: ...@@ -10246,10 +9945,7 @@ function_call_generic:
*/ */
if (!$1.str || check_db_name(&$1)) if (!$1.str || check_db_name(&$1))
{ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
MYSQL_YYABORT;
}
if (check_routine_name(&$3)) if (check_routine_name(&$3))
{ {
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -10473,10 +10169,7 @@ variable: ...@@ -10473,10 +10169,7 @@ variable:
'@' '@'
{ {
if (! Lex->parsing_options.allows_variable) if (! Lex->parsing_options.allows_variable)
{ my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0)));
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
MYSQL_YYABORT;
}
} }
variable_aux variable_aux
{ {
...@@ -10543,9 +10236,8 @@ opt_gorder_clause: ...@@ -10543,9 +10236,8 @@ opt_gorder_clause:
sel->olap != UNSPECIFIED_OLAP_TYPE && sel->olap != UNSPECIFIED_OLAP_TYPE &&
(sel->linkage != UNION_TYPE || sel->braces)) (sel->linkage != UNION_TYPE || sel->braces))
{ {
my_error(ER_WRONG_USAGE, MYF(0), my_yyabort_error((ER_WRONG_USAGE, MYF(0),
"CUBE/ROLLUP", "ORDER BY"); "CUBE/ROLLUP", "ORDER BY"));
MYSQL_YYABORT;
} }
} }
gorder_list; gorder_list;
...@@ -10689,7 +10381,7 @@ table_ref: ...@@ -10689,7 +10381,7 @@ table_ref:
| join_table | join_table
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(lex->thd))) if (!($$= lex->current_select->nest_last_join(thd)))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); my_parse_error(thd, ER_SYNTAX_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -10913,7 +10605,7 @@ table_factor: ...@@ -10913,7 +10605,7 @@ table_factor:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
if ($2->init_nested_join(lex->thd)) if ($2->init_nested_join(thd))
MYSQL_YYABORT; MYSQL_YYABORT;
$$= 0; $$= 0;
/* incomplete derived tables return NULL, we must be /* incomplete derived tables return NULL, we must be
...@@ -10962,7 +10654,7 @@ table_factor: ...@@ -10962,7 +10654,7 @@ table_factor:
Table_ident *ti= new (thd->mem_root) Table_ident(unit); Table_ident *ti= new (thd->mem_root) Table_ident(unit);
if (ti == NULL) if (ti == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
if (!($$= sel->add_table_to_list(lex->thd, if (!($$= sel->add_table_to_list(thd,
ti, $5, 0, ti, $5, 0,
TL_READ, MDL_SHARED_READ))) TL_READ, MDL_SHARED_READ)))
...@@ -11085,17 +10777,15 @@ select_part2_derived: ...@@ -11085,17 +10777,15 @@ select_part2_derived:
select_derived: select_derived:
get_select_lex get_select_lex
{ {
LEX *lex= Lex; if ($1->init_nested_join(thd))
if ($1->init_nested_join(lex->thd))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
derived_table_list derived_table_list
{ {
LEX *lex= Lex;
/* for normal joins, $3 != NULL and end_nested_join() != NULL, /* for normal joins, $3 != NULL and end_nested_join() != NULL,
for derived tables, both must equal NULL */ for derived tables, both must equal NULL */
if (!($$= $1->end_nested_join(lex->thd)) && $3) if (!($$= $1->end_nested_join(thd)) && $3)
MYSQL_YYABORT; MYSQL_YYABORT;
if (!$3 && $$) if (!$3 && $$)
{ {
...@@ -11139,14 +10829,11 @@ select_derived_init: ...@@ -11139,14 +10829,11 @@ select_derived_init:
LEX *lex= Lex; LEX *lex= Lex;
if (! lex->parsing_options.allows_derived) if (! lex->parsing_options.allows_derived)
{ my_yyabort_error((ER_VIEW_SELECT_DERIVED, MYF(0)));
my_error(ER_VIEW_SELECT_DERIVED, MYF(0));
MYSQL_YYABORT;
}
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
TABLE_LIST *embedding; TABLE_LIST *embedding;
if (!sel->embedding || sel->end_nested_join(lex->thd)) if (!sel->embedding || sel->end_nested_join(thd))
{ {
/* we are not in parentheses */ /* we are not in parentheses */
my_parse_error(thd, ER_SYNTAX_ERROR); my_parse_error(thd, ER_SYNTAX_ERROR);
...@@ -11381,14 +11068,11 @@ olap_opt: ...@@ -11381,14 +11068,11 @@ olap_opt:
*/ */
LEX *lex=Lex; LEX *lex=Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH CUBE",
my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE", "global union parameters"));
"global union parameters");
MYSQL_YYABORT;
}
lex->current_select->olap= CUBE_TYPE; lex->current_select->olap= CUBE_TYPE;
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
MYSQL_YYABORT; my_yyabort_error((ER_NOT_SUPPORTED_YET, MYF(0), "CUBE"));
} }
| WITH_ROLLUP_SYM | WITH_ROLLUP_SYM
{ {
...@@ -11401,11 +11085,8 @@ olap_opt: ...@@ -11401,11 +11085,8 @@ olap_opt:
*/ */
LEX *lex= Lex; LEX *lex= Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP", "global union parameters"));
"global union parameters");
MYSQL_YYABORT;
}
lex->current_select->olap= ROLLUP_TYPE; lex->current_select->olap= ROLLUP_TYPE;
} }
; ;
...@@ -11470,7 +11151,7 @@ order_clause: ...@@ -11470,7 +11151,7 @@ order_clause:
if (!unit->is_union() && if (!unit->is_union() &&
(first_sl->order_list.elements || (first_sl->order_list.elements ||
first_sl->select_limit) && first_sl->select_limit) &&
unit->add_fake_select_lex(lex->thd)) unit->add_fake_select_lex(thd))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (sel->master_unit()->is_union() && !sel->braces) if (sel->master_unit()->is_union() && !sel->braces)
...@@ -11587,15 +11268,9 @@ limit_option: ...@@ -11587,15 +11268,9 @@ limit_option:
lex->safe_to_cache_query=0; lex->safe_to_cache_query=0;
} }
else else
{ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
MYSQL_YYABORT;
}
if (splocal->type() != Item::INT_ITEM) if (splocal->type() != Item::INT_ITEM)
{ my_yyabort_error((ER_WRONG_SPVAR_TYPE_IN_LIMIT, MYF(0)));
my_error(ER_WRONG_SPVAR_TYPE_IN_LIMIT, MYF(0));
MYSQL_YYABORT;
}
splocal->limit_clause_param= TRUE; splocal->limit_clause_param= TRUE;
$$= splocal; $$= splocal;
} }
...@@ -11708,16 +11383,10 @@ opt_procedure_clause: ...@@ -11708,16 +11383,10 @@ opt_procedure_clause:
LEX *lex=Lex; LEX *lex=Lex;
if (! lex->parsing_options.allows_select_procedure) if (! lex->parsing_options.allows_select_procedure)
{ my_yyabort_error((ER_VIEW_SELECT_CLAUSE, MYF(0), "PROCEDURE"));
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "PROCEDURE");
MYSQL_YYABORT;
}
if (&lex->select_lex != lex->current_select) if (&lex->select_lex != lex->current_select)
{ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery"));
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery");
MYSQL_YYABORT;
}
lex->proc_list.elements=0; lex->proc_list.elements=0;
lex->proc_list.first=0; lex->proc_list.first=0;
lex->proc_list.next= &lex->proc_list.first; lex->proc_list.next= &lex->proc_list.first;
...@@ -11726,7 +11395,7 @@ opt_procedure_clause: ...@@ -11726,7 +11395,7 @@ opt_procedure_clause:
NULL, NULL, $2.str); NULL, NULL, $2.str);
if (item == NULL) if (item == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
if (add_proc_to_list(lex->thd, item)) if (add_proc_to_list(thd, item))
MYSQL_YYABORT; MYSQL_YYABORT;
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT); Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
...@@ -11811,10 +11480,7 @@ select_outvar: ...@@ -11811,10 +11480,7 @@ select_outvar:
sp_variable *t; sp_variable *t;
if (!Lex->spcont || !(t= Lex->spcont->find_variable($1, false))) if (!Lex->spcont || !(t= Lex->spcont->find_variable($1, false)))
{ my_yyabort_error((ER_SP_UNDECLARED_VAR, MYF(0), $1.str));
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
MYSQL_YYABORT;
}
$$ = Lex->result ? (new (thd->mem_root) $$ = Lex->result ? (new (thd->mem_root)
my_var_sp($1, t->offset, t->type, my_var_sp($1, t->offset, t->type,
Lex->sphead)) : Lex->sphead)) :
...@@ -11831,10 +11497,7 @@ into: ...@@ -11831,10 +11497,7 @@ into:
INTO INTO
{ {
if (! Lex->parsing_options.allows_select_into) if (! Lex->parsing_options.allows_select_into)
{ my_yyabort_error((ER_VIEW_SELECT_CLAUSE, MYF(0), "INTO"));
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "INTO");
MYSQL_YYABORT;
}
} }
into_destination into_destination
; ;
...@@ -11914,7 +11577,7 @@ drop: ...@@ -11914,7 +11577,7 @@ drop:
lex->alter_info.reset(); lex->alter_info.reset();
lex->alter_info.flags= Alter_info::ALTER_DROP_INDEX; lex->alter_info.flags= Alter_info::ALTER_DROP_INDEX;
lex->alter_info.drop_list.push_back(ad, thd->mem_root); lex->alter_info.drop_list.push_back(ad, thd->mem_root);
if (!lex->current_select->add_table_to_list(lex->thd, $6, NULL, if (!lex->current_select->add_table_to_list(thd, $6, NULL,
TL_OPTION_UPDATING, TL_OPTION_UPDATING,
TL_READ_NO_INSERT, TL_READ_NO_INSERT,
MDL_SHARED_UPGRADABLE)) MDL_SHARED_UPGRADABLE))
...@@ -11931,17 +11594,11 @@ drop: ...@@ -11931,17 +11594,11 @@ drop:
LEX *lex= thd->lex; LEX *lex= thd->lex;
sp_name *spname; sp_name *spname;
if ($4.str && check_db_name(&$4)) if ($4.str && check_db_name(&$4))
{ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $4.str));
my_error(ER_WRONG_DB_NAME, MYF(0), $4.str);
MYSQL_YYABORT;
}
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
MYSQL_YYABORT;
}
lex->set_command(SQLCOM_DROP_FUNCTION, $3); lex->set_command(SQLCOM_DROP_FUNCTION, $3);
spname= new (lex->thd->mem_root) sp_name($4, $6, true); spname= new (thd->mem_root) sp_name($4, $6, true);
if (spname == NULL) if (spname == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
spname->init_qname(thd); spname->init_qname(thd);
...@@ -11953,14 +11610,11 @@ drop: ...@@ -11953,14 +11610,11 @@ drop:
LEX_STRING db= {0, 0}; LEX_STRING db= {0, 0};
sp_name *spname; sp_name *spname;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"));
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
MYSQL_YYABORT;
}
if (thd->db && lex->copy_db_to(&db.str, &db.length)) if (thd->db && lex->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->set_command(SQLCOM_DROP_FUNCTION, $3); lex->set_command(SQLCOM_DROP_FUNCTION, $3);
spname= new (lex->thd->mem_root) sp_name(db, $4, false); spname= new (thd->mem_root) sp_name(db, $4, false);
if (spname == NULL) if (spname == NULL)
MYSQL_YYABORT; MYSQL_YYABORT;
spname->init_qname(thd); spname->init_qname(thd);
...@@ -11970,10 +11624,7 @@ drop: ...@@ -11970,10 +11624,7 @@ drop:
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"));
my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
MYSQL_YYABORT;
}
lex->set_command(SQLCOM_DROP_PROCEDURE, $3); lex->set_command(SQLCOM_DROP_PROCEDURE, $3);
lex->spname= $4; lex->spname= $4;
} }
...@@ -13005,14 +12656,9 @@ opt_format_json: ...@@ -13005,14 +12656,9 @@ opt_format_json:
if (!my_strcasecmp(system_charset_info, $3.str, "JSON")) if (!my_strcasecmp(system_charset_info, $3.str, "JSON"))
Lex->explain_json= true; Lex->explain_json= true;
else if (!my_strcasecmp(system_charset_info, $3.str, "TRADITIONAL")) else if (!my_strcasecmp(system_charset_info, $3.str, "TRADITIONAL"))
{
DBUG_ASSERT(Lex->explain_json==false); DBUG_ASSERT(Lex->explain_json==false);
}
else else
{ my_yyabort_error((ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), $3.str));
my_error(ER_UNKNOWN_EXPLAIN_FORMAT, MYF(0), $3.str);
MYSQL_YYABORT;
}
} }
; ;
...@@ -13109,10 +12755,7 @@ flush_option: ...@@ -13109,10 +12755,7 @@ flush_option:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->type & REFRESH_RELAY_LOG) if (lex->type & REFRESH_RELAY_LOG)
{ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH", "RELAY LOGS"));
my_error(ER_WRONG_USAGE, MYF(0), "FLUSH", "RELAY LOGS");
MYSQL_YYABORT;
}
lex->type|= REFRESH_RELAY_LOG; lex->type|= REFRESH_RELAY_LOG;
lex->relay_log_connection_name= lex->mi.connection_name; lex->relay_log_connection_name= lex->mi.connection_name;
} }
...@@ -13133,10 +12776,7 @@ flush_option: ...@@ -13133,10 +12776,7 @@ flush_option:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->type & REFRESH_SLAVE) if (lex->type & REFRESH_SLAVE)
{ my_yyabort_error((ER_WRONG_USAGE, MYF(0), "FLUSH","SLAVE"));
my_error(ER_WRONG_USAGE, MYF(0), "FLUSH","SLAVE");
MYSQL_YYABORT;
}
lex->type|= REFRESH_SLAVE; lex->type|= REFRESH_SLAVE;
lex->reset_slave_info.all= false; lex->reset_slave_info.all= false;
} }
...@@ -13615,19 +13255,13 @@ param_marker: ...@@ -13615,19 +13255,13 @@ param_marker:
Lex_input_stream *lip= YYLIP; Lex_input_stream *lip= YYLIP;
Item_param *item; Item_param *item;
if (! lex->parsing_options.allows_variable) if (! lex->parsing_options.allows_variable)
{ my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0)));
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
MYSQL_YYABORT;
}
const char *query_start= lex->sphead ? lex->sphead->m_tmp_query const char *query_start= lex->sphead ? lex->sphead->m_tmp_query
: thd->query(); : thd->query();
item= new (thd->mem_root) Item_param(thd, lip->get_tok_start() - item= new (thd->mem_root) Item_param(thd, lip->get_tok_start() -
query_start); query_start);
if (!($$= item) || lex->param_list.push_back(item, thd->mem_root)) if (!($$= item) || lex->param_list.push_back(item, thd->mem_root))
{ my_yyabort_error((ER_OUT_OF_RESOURCES, MYF(0)));
my_message(ER_OUT_OF_RESOURCES, ER_THD(thd, ER_OUT_OF_RESOURCES), MYF(0));
MYSQL_YYABORT;
}
} }
; ;
...@@ -13825,10 +13459,7 @@ simple_ident: ...@@ -13825,10 +13459,7 @@ simple_ident:
{ {
/* We're compiling a stored procedure and found a variable */ /* We're compiling a stored procedure and found a variable */
if (! lex->parsing_options.allows_variable) if (! lex->parsing_options.allows_variable)
{ my_yyabort_error((ER_VIEW_SELECT_VARIABLE, MYF(0)));
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
MYSQL_YYABORT;
}
Item_splocal *splocal; Item_splocal *splocal;
splocal= new (thd->mem_root) splocal= new (thd->mem_root)
...@@ -13904,17 +13535,11 @@ simple_ident_q: ...@@ -13904,17 +13535,11 @@ simple_ident_q:
if (lex->trg_chistics.event == TRG_EVENT_INSERT && if (lex->trg_chistics.event == TRG_EVENT_INSERT &&
!new_row) !new_row)
{ my_yyabort_error((ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "OLD", "on INSERT"));
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "OLD", "on INSERT");
MYSQL_YYABORT;
}
if (lex->trg_chistics.event == TRG_EVENT_DELETE && if (lex->trg_chistics.event == TRG_EVENT_DELETE &&
new_row) new_row)
{ my_yyabort_error((ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "NEW", "on DELETE"));
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "NEW", "on DELETE");
MYSQL_YYABORT;
}
DBUG_ASSERT(!new_row || DBUG_ASSERT(!new_row ||
(lex->trg_chistics.event == TRG_EVENT_INSERT || (lex->trg_chistics.event == TRG_EVENT_INSERT ||
...@@ -14023,26 +13648,17 @@ field_ident: ...@@ -14023,26 +13648,17 @@ field_ident:
{ {
TABLE_LIST *table= Select->table_list.first; TABLE_LIST *table= Select->table_list.first;
if (my_strcasecmp(table_alias_charset, $1.str, table->db)) if (my_strcasecmp(table_alias_charset, $1.str, table->db))
{ my_yyabort_error((ER_WRONG_DB_NAME, MYF(0), $1.str));
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
MYSQL_YYABORT;
}
if (my_strcasecmp(table_alias_charset, $3.str, if (my_strcasecmp(table_alias_charset, $3.str,
table->table_name)) table->table_name))
{ my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $3.str));
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str);
MYSQL_YYABORT;
}
$$=$5; $$=$5;
} }
| ident '.' ident | ident '.' ident
{ {
TABLE_LIST *table= Select->table_list.first; TABLE_LIST *table= Select->table_list.first;
if (my_strcasecmp(table_alias_charset, $1.str, table->alias)) if (my_strcasecmp(table_alias_charset, $1.str, table->alias))
{ my_yyabort_error((ER_WRONG_TABLE_NAME, MYF(0), $1.str));
my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str);
MYSQL_YYABORT;
}
$$=$3; $$=$3;
} }
| '.' ident { $$=$2;} /* For Delphi */ | '.' ident { $$=$2;} /* For Delphi */
...@@ -14678,10 +14294,7 @@ set: ...@@ -14678,10 +14294,7 @@ set:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->table_or_sp_used()) if (lex->table_or_sp_used())
{ my_yyabort_error((ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT"));
my_error(ER_SUBQUERIES_NOT_SUPPORTED, MYF(0), "SET STATEMENT");
MYSQL_YYABORT;
}
lex->stmt_var_list= lex->var_list; lex->stmt_var_list= lex->var_list;
lex->var_list.empty(); lex->var_list.empty();
} }
...@@ -15010,10 +14623,7 @@ internal_variable_name: ...@@ -15010,10 +14623,7 @@ internal_variable_name:
!my_strcasecmp(system_charset_info, $1.str, "OLD"))) !my_strcasecmp(system_charset_info, $1.str, "OLD")))
{ {
if ($1.str[0]=='O' || $1.str[0]=='o') if ($1.str[0]=='O' || $1.str[0]=='o')
{ my_yyabort_error((ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", ""));
my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", "");
MYSQL_YYABORT;
}
if (lex->trg_chistics.event == TRG_EVENT_DELETE) if (lex->trg_chistics.event == TRG_EVENT_DELETE)
{ {
my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0),
...@@ -15021,10 +14631,7 @@ internal_variable_name: ...@@ -15021,10 +14631,7 @@ internal_variable_name:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (lex->trg_chistics.action_time == TRG_ACTION_AFTER) if (lex->trg_chistics.action_time == TRG_ACTION_AFTER)
{ my_yyabort_error((ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after "));
my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after ");
MYSQL_YYABORT;
}
/* This special combination will denote field of NEW row */ /* This special combination will denote field of NEW row */
$$.var= trg_new_row_fake_var; $$.var= trg_new_row_fake_var;
$$.base_name= $3; $$.base_name= $3;
...@@ -15116,10 +14723,7 @@ opt_for_user: ...@@ -15116,10 +14723,7 @@ opt_for_user:
LEX_STRING pw= { C_STRING_WITH_LEN("password") }; LEX_STRING pw= { C_STRING_WITH_LEN("password") };
if (spc && spc->find_variable(pw, false)) if (spc && spc->find_variable(pw, false))
{ my_yyabort_error((ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str));
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str);
MYSQL_YYABORT;
}
if (!(lex->definer= (LEX_USER*) thd->calloc(sizeof(LEX_USER)))) if (!(lex->definer= (LEX_USER*) thd->calloc(sizeof(LEX_USER))))
MYSQL_YYABORT; MYSQL_YYABORT;
lex->definer->user= current_user; lex->definer->user= current_user;
...@@ -15172,10 +14776,7 @@ lock: ...@@ -15172,10 +14776,7 @@ lock:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "LOCK"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK");
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_LOCK_TABLES; lex->sql_command= SQLCOM_LOCK_TABLES;
} }
table_lock_list table_lock_list
...@@ -15225,10 +14826,7 @@ unlock: ...@@ -15225,10 +14826,7 @@ unlock:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "UNLOCK"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK");
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_UNLOCK_TABLES; lex->sql_command= SQLCOM_UNLOCK_TABLES;
} }
table_or_tables table_or_tables
...@@ -15244,34 +14842,25 @@ handler: ...@@ -15244,34 +14842,25 @@ handler:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_HA_OPEN; lex->sql_command = SQLCOM_HA_OPEN;
if (!lex->current_select->add_table_to_list(lex->thd, $2, $4, 0)) if (!lex->current_select->add_table_to_list(thd, $2, $4, 0))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| HANDLER_SYM table_ident_nodb CLOSE_SYM | HANDLER_SYM table_ident_nodb CLOSE_SYM
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
MYSQL_YYABORT;
}
lex->sql_command = SQLCOM_HA_CLOSE; lex->sql_command = SQLCOM_HA_CLOSE;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0)) if (!lex->current_select->add_table_to_list(thd, $2, 0, 0))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
| HANDLER_SYM table_ident_nodb READ_SYM | HANDLER_SYM table_ident_nodb READ_SYM
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_BADSTATEMENT, MYF(0), "HANDLER"));
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
MYSQL_YYABORT;
}
lex->expr_allows_subselect= FALSE; lex->expr_allows_subselect= FALSE;
lex->sql_command = SQLCOM_HA_READ; lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */ lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
...@@ -15281,7 +14870,7 @@ handler: ...@@ -15281,7 +14870,7 @@ handler:
lex->current_select->select_limit= one; lex->current_select->select_limit= one;
lex->current_select->offset_limit= 0; lex->current_select->offset_limit= 0;
lex->limit_rows_examined= 0; lex->limit_rows_examined= 0;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0)) if (!lex->current_select->add_table_to_list(thd, $2, 0, 0))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
handler_read_or_scan opt_where_clause opt_limit_clause handler_read_or_scan opt_where_clause opt_limit_clause
...@@ -15487,10 +15076,7 @@ grant_role: ...@@ -15487,10 +15076,7 @@ grant_role:
/* trim end spaces (as they'll be lost in mysql.user anyway) */ /* trim end spaces (as they'll be lost in mysql.user anyway) */
$1.length= cs->cset->lengthsp(cs, $1.str, $1.length); $1.length= cs->cset->lengthsp(cs, $1.str, $1.length);
if ($1.length == 0) if ($1.length == 0)
{ my_yyabort_error((ER_INVALID_ROLE, MYF(0), ""));
my_error(ER_INVALID_ROLE, MYF(0), "");
MYSQL_YYABORT;
}
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
MYSQL_YYABORT; MYSQL_YYABORT;
$$->user = $1; $$->user = $1;
...@@ -15585,30 +15171,21 @@ require_list_element: ...@@ -15585,30 +15171,21 @@ require_list_element:
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->x509_subject) if (lex->x509_subject)
{ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "SUBJECT"));
my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT");
MYSQL_YYABORT;
}
lex->x509_subject=$2.str; lex->x509_subject=$2.str;
} }
| ISSUER_SYM TEXT_STRING | ISSUER_SYM TEXT_STRING
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->x509_issuer) if (lex->x509_issuer)
{ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "ISSUER"));
my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER");
MYSQL_YYABORT;
}
lex->x509_issuer=$2.str; lex->x509_issuer=$2.str;
} }
| CIPHER_SYM TEXT_STRING | CIPHER_SYM TEXT_STRING
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->ssl_cipher) if (lex->ssl_cipher)
{ my_yyabort_error((ER_DUP_ARGUMENT, MYF(0), "CIPHER"));
my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER");
MYSQL_YYABORT;
}
lex->ssl_cipher=$2.str; lex->ssl_cipher=$2.str;
} }
; ;
...@@ -15623,11 +15200,7 @@ grant_ident: ...@@ -15623,11 +15200,7 @@ grant_ident:
if (lex->grant == GLOBAL_ACLS) if (lex->grant == GLOBAL_ACLS)
lex->grant = DB_ACLS & ~GRANT_ACL; lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
MYSQL_YYABORT;
}
} }
| ident '.' '*' | ident '.' '*'
{ {
...@@ -15636,11 +15209,7 @@ grant_ident: ...@@ -15636,11 +15209,7 @@ grant_ident:
if (lex->grant == GLOBAL_ACLS) if (lex->grant == GLOBAL_ACLS)
lex->grant = DB_ACLS & ~GRANT_ACL; lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
MYSQL_YYABORT;
}
} }
| '*' '.' '*' | '*' '.' '*'
{ {
...@@ -15649,16 +15218,12 @@ grant_ident: ...@@ -15649,16 +15218,12 @@ grant_ident:
if (lex->grant == GLOBAL_ACLS) if (lex->grant == GLOBAL_ACLS)
lex->grant= GLOBAL_ACLS & ~GRANT_ACL; lex->grant= GLOBAL_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ my_yyabort_error((ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0)));
my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER_THD(thd, ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
MYSQL_YYABORT;
}
} }
| table_ident | table_ident
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL, if (!lex->current_select->add_table_to_list(thd, $1,NULL,
TL_OPTION_UPDATING)) TL_OPTION_UPDATING))
MYSQL_YYABORT; MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS) if (lex->grant == GLOBAL_ACLS)
...@@ -16339,10 +15904,7 @@ trigger_tail: ...@@ -16339,10 +15904,7 @@ trigger_tail:
Lex_input_stream *lip= YYLIP; Lex_input_stream *lip= YYLIP;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER"));
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER");
MYSQL_YYABORT;
}
lex->stmt_definition_begin= $2; lex->stmt_definition_begin= $2;
lex->ident.str= $9; lex->ident.str= $9;
...@@ -16399,10 +15961,7 @@ udf_tail2: ...@@ -16399,10 +15961,7 @@ udf_tail2:
if (lex->add_create_options_with_check($2)) if (lex->add_create_options_with_check($2))
MYSQL_YYABORT; MYSQL_YYABORT;
if (is_native_function(thd, & $3)) if (is_native_function(thd, & $3))
{ my_yyabort_error((ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str));
my_error(ER_NATIVE_FCT_NAME_COLLISION, MYF(0), $3.str);
MYSQL_YYABORT;
}
lex->sql_command= SQLCOM_CREATE_FUNCTION; lex->sql_command= SQLCOM_CREATE_FUNCTION;
lex->udf.name= $3; lex->udf.name= $3;
lex->udf.returns= (Item_result) $5; lex->udf.returns= (Item_result) $5;
...@@ -16425,10 +15984,7 @@ sf_tail: ...@@ -16425,10 +15984,7 @@ sf_tail:
lex->spname= $3; lex->spname= $3;
if (lex->sphead) if (lex->sphead)
{ my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION"));
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
MYSQL_YYABORT;
}
if (!make_sp_head(thd, $3, TYPE_ENUM_FUNCTION)) if (!make_sp_head(thd, $3, TYPE_ENUM_FUNCTION))
MYSQL_YYABORT; MYSQL_YYABORT;
...@@ -16472,10 +16028,7 @@ sf_tail: ...@@ -16472,10 +16028,7 @@ sf_tail:
lex->sql_command= SQLCOM_CREATE_SPFUNCTION; lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
sp->set_stmt_end(thd); sp->set_stmt_end(thd);
if (!(sp->m_flags & sp_head::HAS_RETURN)) if (!(sp->m_flags & sp_head::HAS_RETURN))
{ my_yyabort_error((ER_SP_NORETURN, MYF(0), sp->m_qname.str));
my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str);
MYSQL_YYABORT;
}
if (is_native_function(thd, & sp->m_name)) if (is_native_function(thd, & sp->m_name))
{ {
/* /*
...@@ -16522,10 +16075,7 @@ sp_tail: ...@@ -16522,10 +16075,7 @@ sp_tail:
MYSQL_YYABORT; MYSQL_YYABORT;
if (Lex->sphead) if (Lex->sphead)
{ my_yyabort_error((ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE"));
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
MYSQL_YYABORT;
}
if (!make_sp_head(thd, $3, TYPE_ENUM_PROCEDURE)) if (!make_sp_head(thd, $3, TYPE_ENUM_PROCEDURE))
MYSQL_YYABORT; MYSQL_YYABORT;
......
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