Commit c21fc008 authored by Alexander Barkov's avatar Alexander Barkov

Moving the code from my_parse_error() to THD::parse_error().

Reusing THD::parse_error() in sql_yacc.yy and sql_yacc_ora.yy
parent 9f6aca19
...@@ -3882,6 +3882,37 @@ class THD :public Statement, ...@@ -3882,6 +3882,37 @@ class THD :public Statement,
*/ */
void raise_note_printf(uint code, ...); void raise_note_printf(uint code, ...);
/**
@brief Push an error message into MySQL error stack with line
and position information.
This function provides semantic action implementers with a way
to push the famous "You have a syntax error near..." error
message into the error stack, which is normally produced only if
a parse error is discovered internally by the Bison generated
parser.
*/
void parse_error(const char *err_text, const char *yytext)
{
Lex_input_stream *lip= &m_parser_state->m_lip;
if (!yytext)
{
if (!(yytext= lip->get_tok_start()))
yytext= "";
}
/* Push an error into the error stack */
ErrConvString err(yytext, strlen(yytext), variables.character_set_client);
my_printf_error(ER_PARSE_ERROR, ER_THD(this, ER_PARSE_ERROR), MYF(0),
err_text, err.ptr(), lip->yylineno);
}
void parse_error(uint err_number, const char *yytext= 0)
{
return parse_error(ER_THD(this, err_number), yytext);
}
void parse_error()
{
return parse_error(ER_SYNTAX_ERROR);
}
private: private:
/* /*
Only the implementation of the SIGNAL and RESIGNAL statements Only the implementation of the SIGNAL and RESIGNAL statements
......
...@@ -31,6 +31,13 @@ ...@@ -31,6 +31,13 @@
#include "sql_select.h" #include "sql_select.h"
#include "sql_cte.h" #include "sql_cte.h"
void LEX::parse_error()
{
thd->parse_error();
}
static int lex_one_token(YYSTYPE *yylval, THD *thd); static int lex_one_token(YYSTYPE *yylval, THD *thd);
/* /*
......
...@@ -99,7 +99,7 @@ int yylex(void *yylval, void *yythd); ...@@ -99,7 +99,7 @@ int yylex(void *yylval, void *yythd);
#define MYSQL_YYABORT_UNLESS(A) \ #define MYSQL_YYABORT_UNLESS(A) \
if (!(A)) \ if (!(A)) \
{ \ { \
my_parse_error(thd, ER_SYNTAX_ERROR); \ thd->parse_error(); \
MYSQL_YYABORT; \ MYSQL_YYABORT; \
} }
...@@ -112,43 +112,6 @@ int yylex(void *yylval, void *yythd); ...@@ -112,43 +112,6 @@ int yylex(void *yylval, void *yythd);
#define YYDEBUG 0 #define YYDEBUG 0
#endif #endif
/**
@brief Push an error message into MySQL error stack with line
and position information.
This function provides semantic action implementers with a way
to push the famous "You have a syntax error near..." error
message into the error stack, which is normally produced only if
a parse error is discovered internally by the Bison generated
parser.
*/
static void my_parse_error_intern(THD *thd, const char *err_text,
const char *yytext)
{
Lex_input_stream *lip= &thd->m_parser_state->m_lip;
if (!yytext)
{
if (!(yytext= lip->get_tok_start()))
yytext= "";
}
/* Push an error into the error stack */
ErrConvString err(yytext, strlen(yytext),
thd->variables.character_set_client);
my_error(ER_PARSE_ERROR, MYF(0), err_text, err.ptr(), lip->yylineno);
}
static void my_parse_error(THD *thd, uint err_number, const char *yytext=0)
{
return my_parse_error_intern(thd, ER_THD(thd, err_number), yytext);
}
void LEX::parse_error()
{
my_parse_error(thd, ER_SYNTAX_ERROR);
}
/** /**
@brief Bison callback to report a syntax/OOM error @brief Bison callback to report a syntax/OOM error
...@@ -165,7 +128,7 @@ void LEX::parse_error() ...@@ -165,7 +128,7 @@ void LEX::parse_error()
This function is not for use in semantic actions and is internal to This function is not for use in semantic actions and is internal to
the parser, as it performs some pre-return cleanup. the parser, as it performs some pre-return cleanup.
In semantic actions, please use my_parse_error or my_error to In semantic actions, please use thd->parse_error() or my_error to
push an error into the error stack and MYSQL_YYABORT push an error into the error stack and MYSQL_YYABORT
to abort from the parser. to abort from the parser.
*/ */
...@@ -182,7 +145,7 @@ void MYSQLerror(THD *thd, const char *s) ...@@ -182,7 +145,7 @@ void MYSQLerror(THD *thd, const char *s)
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */ /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0) if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s= ER_THD(thd, ER_SYNTAX_ERROR); s= ER_THD(thd, ER_SYNTAX_ERROR);
my_parse_error_intern(thd, s, 0); thd->parse_error(s, 0);
} }
...@@ -674,7 +637,7 @@ bool LEX::add_select_to_union_list(bool is_union_distinct, ...@@ -674,7 +637,7 @@ bool LEX::add_select_to_union_list(bool is_union_distinct,
} }
if (current_select->linkage == GLOBAL_OPTIONS_TYPE) if (current_select->linkage == GLOBAL_OPTIONS_TYPE)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
return TRUE; return TRUE;
} }
if (!is_union_distinct && (type == INTERSECT_TYPE || type == EXCEPT_TYPE)) if (!is_union_distinct && (type == INTERSECT_TYPE || type == EXCEPT_TYPE))
...@@ -719,7 +682,6 @@ bool LEX::add_select_to_union_list(bool is_union_distinct, ...@@ -719,7 +682,6 @@ bool LEX::add_select_to_union_list(bool is_union_distinct,
} }
/** /**
Create a separate LEX for each assignment if in SP. Create a separate LEX for each assignment if in SP.
...@@ -3422,7 +3384,7 @@ signal_allowed_expr: ...@@ -3422,7 +3384,7 @@ signal_allowed_expr:
SIGNAL/RESIGNAL ... SIGNAL/RESIGNAL ...
SET <signal condition item name> = @foo := expr SET <signal condition item name> = @foo := expr
*/ */
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4915,7 +4877,7 @@ partition_entry: ...@@ -4915,7 +4877,7 @@ partition_entry:
LEX *lex= Lex; LEX *lex= Lex;
if (!lex->part_info) if (!lex->part_info)
{ {
my_parse_error(thd, ER_PARTITION_ENTRY_ERROR); thd->parse_error(ER_PARTITION_ENTRY_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
/* /*
...@@ -4972,7 +4934,7 @@ opt_key_algo: ...@@ -4972,7 +4934,7 @@ opt_key_algo:
Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55; Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -5088,7 +5050,7 @@ part_func_expr: ...@@ -5088,7 +5050,7 @@ part_func_expr:
{ {
if (!Lex->safe_to_cache_query) if (!Lex->safe_to_cache_query)
{ {
my_parse_error(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR); thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
$$=$1; $$=$1;
...@@ -5128,7 +5090,7 @@ part_defs: ...@@ -5128,7 +5090,7 @@ part_defs:
if (part_info->num_parts != if (part_info->num_parts !=
count_curr_parts) count_curr_parts)
{ {
my_parse_error(thd, ER_PARTITION_WRONG_NO_PART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_PART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -5258,7 +5220,7 @@ part_func_max: ...@@ -5258,7 +5220,7 @@ part_func_max:
part_info->num_columns != 1U) part_info->num_columns != 1U)
{ {
part_info->print_debug("Kilroy II", NULL); part_info->print_debug("Kilroy II", NULL);
my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR); thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
else else
...@@ -5289,7 +5251,7 @@ part_values_in: ...@@ -5289,7 +5251,7 @@ part_values_in:
part_info->num_columns > MAX_REF_PARTS) part_info->num_columns > MAX_REF_PARTS)
{ {
part_info->print_debug("Kilroy III", NULL); part_info->print_debug("Kilroy III", NULL);
my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR); thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
/* /*
...@@ -5310,7 +5272,7 @@ part_values_in: ...@@ -5310,7 +5272,7 @@ part_values_in:
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (part_info->num_columns < 2U) if (part_info->num_columns < 2U)
{ {
my_parse_error(thd, ER_ROW_SINGLE_PARTITION_FIELD_ERROR); thd->parse_error(ER_ROW_SINGLE_PARTITION_FIELD_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -5351,7 +5313,7 @@ part_value_item: ...@@ -5351,7 +5313,7 @@ part_value_item:
error. error.
*/ */
part_info->print_debug("Kilroy I", NULL); part_info->print_debug("Kilroy I", NULL);
my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR); thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
part_info->curr_list_object= 0; part_info->curr_list_object= 0;
...@@ -5369,7 +5331,7 @@ part_value_expr_item: ...@@ -5369,7 +5331,7 @@ part_value_expr_item:
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (part_info->part_type == LIST_PARTITION) if (part_info->part_type == LIST_PARTITION)
{ {
my_parse_error(thd, ER_MAXVALUE_IN_VALUES_IN); thd->parse_error(ER_MAXVALUE_IN_VALUES_IN);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (part_info->add_max_value(thd)) if (part_info->add_max_value(thd))
...@@ -5385,7 +5347,7 @@ part_value_expr_item: ...@@ -5385,7 +5347,7 @@ part_value_expr_item:
if (!lex->safe_to_cache_query) if (!lex->safe_to_cache_query)
{ {
my_parse_error(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR); thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (part_info->add_column_list_value(thd, part_expr)) if (part_info->add_column_list_value(thd, part_expr))
...@@ -5407,7 +5369,7 @@ opt_sub_partition: ...@@ -5407,7 +5369,7 @@ opt_sub_partition:
We come here when we have defined subpartitions on the first We come here when we have defined subpartitions on the first
partition but not on all the subsequent partitions. partition but not on all the subsequent partitions.
*/ */
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -5419,7 +5381,7 @@ opt_sub_partition: ...@@ -5419,7 +5381,7 @@ opt_sub_partition:
if (part_info->num_subparts != if (part_info->num_subparts !=
part_info->count_curr_subparts) part_info->count_curr_subparts)
{ {
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -5427,7 +5389,7 @@ opt_sub_partition: ...@@ -5427,7 +5389,7 @@ opt_sub_partition:
{ {
if (part_info->partitions.elements > 1) if (part_info->partitions.elements > 1)
{ {
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
part_info->num_subparts= part_info->count_curr_subparts; part_info->num_subparts= part_info->count_curr_subparts;
...@@ -5462,7 +5424,7 @@ sub_part_definition: ...@@ -5462,7 +5424,7 @@ sub_part_definition:
the second partition (the current partition processed the second partition (the current partition processed
have already been put into the partitions list. have already been put into the partitions list.
*/ */
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (!sub_p_elem || if (!sub_p_elem ||
...@@ -5696,7 +5658,7 @@ create_table_option: ...@@ -5696,7 +5658,7 @@ create_table_option:
Lex->create_info.table_options|= HA_OPTION_PACK_KEYS; Lex->create_info.table_options|= HA_OPTION_PACK_KEYS;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS; Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
...@@ -5717,7 +5679,7 @@ create_table_option: ...@@ -5717,7 +5679,7 @@ create_table_option:
Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_ON; Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_ON;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.used_fields|= HA_CREATE_USED_STATS_AUTO_RECALC; Lex->create_info.used_fields|= HA_CREATE_USED_STATS_AUTO_RECALC;
...@@ -5737,7 +5699,7 @@ create_table_option: ...@@ -5737,7 +5699,7 @@ create_table_option:
Lex->create_info.table_options|= HA_OPTION_STATS_PERSISTENT; Lex->create_info.table_options|= HA_OPTION_STATS_PERSISTENT;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.used_fields|= HA_CREATE_USED_STATS_PERSISTENT; Lex->create_info.used_fields|= HA_CREATE_USED_STATS_PERSISTENT;
...@@ -5760,7 +5722,7 @@ create_table_option: ...@@ -5760,7 +5722,7 @@ create_table_option:
we can store the higher bits from stats_sample_pages in .frm too. */ we can store the higher bits from stats_sample_pages in .frm too. */
if ($3 == 0 || $3 > 0xffff) if ($3 == 0 || $3 > 0xffff)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.stats_sample_pages=$3; Lex->create_info.stats_sample_pages=$3;
...@@ -6755,7 +6717,7 @@ ws_nweights: ...@@ -6755,7 +6717,7 @@ ws_nweights:
{ {
if ($2 == 0) if ($2 == 0)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -7249,7 +7211,7 @@ alter: ...@@ -7249,7 +7211,7 @@ alter:
{ {
if (!($7 || $8 || $9 || $10 || $11)) if (!($7 || $8 || $9 || $10 || $11))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
/* /*
...@@ -7888,7 +7850,7 @@ start: ...@@ -7888,7 +7850,7 @@ start:
if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) && if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) &&
($3 & MYSQL_START_TRANS_OPT_READ_ONLY)) ($3 & MYSQL_START_TRANS_OPT_READ_ONLY))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->start_transaction_opt= $3; lex->start_transaction_opt= $3;
...@@ -10142,7 +10104,7 @@ function_call_generic: ...@@ -10142,7 +10104,7 @@ function_call_generic:
{ {
if (lex->current_select->inc_in_sum_expr()) if (lex->current_select->inc_in_sum_expr())
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10625,7 +10587,7 @@ variable_aux: ...@@ -10625,7 +10587,7 @@ variable_aux:
/* disallow "SELECT @@global.global.variable" */ /* disallow "SELECT @@global.global.variable" */
if ($3.str && $4.str && check_reserved_words(&$3)) if ($3.str && $4.str && check_reserved_words(&$3))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (!($$= get_system_var(thd, $2, $3, $4))) if (!($$= get_system_var(thd, $2, $3, $4)))
...@@ -10668,7 +10630,7 @@ in_sum_expr: ...@@ -10668,7 +10630,7 @@ in_sum_expr:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->current_select->inc_in_sum_expr()) if (lex->current_select->inc_in_sum_expr())
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10787,7 +10749,7 @@ table_ref: ...@@ -10787,7 +10749,7 @@ table_ref:
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(thd))) if (!($$= lex->current_select->nest_last_join(thd)))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -11064,7 +11026,7 @@ table_primary_derived: ...@@ -11064,7 +11026,7 @@ table_primary_derived:
Tables with or without joins within parentheses cannot Tables with or without joins within parentheses cannot
have aliases, and we ruled out derived tables above. have aliases, and we ruled out derived tables above.
*/ */
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
else else
...@@ -11129,7 +11091,7 @@ select_derived_union: ...@@ -11129,7 +11091,7 @@ select_derived_union:
{ {
if ($1) if ($1)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -11137,7 +11099,7 @@ select_derived_union: ...@@ -11137,7 +11099,7 @@ select_derived_union:
{ {
if ($1) if ($1)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -11193,7 +11155,7 @@ select_derived: ...@@ -11193,7 +11155,7 @@ select_derived:
MYSQL_YYABORT; MYSQL_YYABORT;
if (!$2 && $$) if (!$2 && $$)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -11220,7 +11182,7 @@ select_derived2: ...@@ -11220,7 +11182,7 @@ select_derived2:
if (!lex->expr_allows_subselect || if (!lex->expr_allows_subselect ||
lex->sql_command == (int)SQLCOM_PURGE) lex->sql_command == (int)SQLCOM_PURGE)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
...@@ -11882,8 +11844,8 @@ delete_limit_clause: ...@@ -11882,8 +11844,8 @@ delete_limit_clause:
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT);
sel->explicit_limit= 1; sel->explicit_limit= 1;
} }
| LIMIT ROWS_SYM EXAMINED_SYM { my_parse_error(thd, ER_SYNTAX_ERROR); MYSQL_YYABORT; } | LIMIT ROWS_SYM EXAMINED_SYM { thd->parse_error(); MYSQL_YYABORT; }
| LIMIT limit_option ROWS_SYM EXAMINED_SYM { my_parse_error(thd, ER_SYNTAX_ERROR); MYSQL_YYABORT; } | LIMIT limit_option ROWS_SYM EXAMINED_SYM { thd->parse_error(); MYSQL_YYABORT; }
; ;
int_num: int_num:
...@@ -11927,7 +11889,7 @@ real_ulonglong_num: ...@@ -11927,7 +11889,7 @@ real_ulonglong_num:
dec_num_error: dec_num_error:
dec_num dec_num
{ my_parse_error(thd, ER_ONLY_INTEGERS_ALLOWED); } { thd->parse_error(ER_ONLY_INTEGERS_ALLOWED); }
; ;
dec_num: dec_num:
...@@ -13081,12 +13043,12 @@ show_param: ...@@ -13081,12 +13043,12 @@ show_param:
ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str, &in_plugin); ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str, &in_plugin);
if (!table || !table->old_format || !in_plugin) if (!table || !table->old_format || !in_plugin)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR, $2); thd->parse_error(ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (lex->wild && table->idx_field1 < 0) if (lex->wild && table->idx_field1 < 0)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR, $3); thd->parse_error(ER_SYNTAX_ERROR, $3);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (make_schema_select(thd, Lex->current_select, table)) if (make_schema_select(thd, Lex->current_select, table))
...@@ -13287,7 +13249,7 @@ flush_lock: ...@@ -13287,7 +13249,7 @@ flush_lock:
{ {
if (Lex->query_tables == NULL) // Table list can't be empty if (Lex->query_tables == NULL) // Table list can't be empty
{ {
my_parse_error(thd, ER_NO_TABLES_USED); thd->parse_error(ER_NO_TABLES_USED);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->type|= REFRESH_FOR_EXPORT; Lex->type|= REFRESH_FOR_EXPORT;
...@@ -13352,7 +13314,7 @@ flush_option: ...@@ -13352,7 +13314,7 @@ flush_option:
ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str); ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str);
if (!table || !table->reset_table) if (!table || !table->reset_table)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR, $2); thd->parse_error(ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->view_list.push_back((LEX_STRING*) Lex->view_list.push_back((LEX_STRING*)
...@@ -15080,7 +15042,7 @@ option_value_following_option_type: ...@@ -15080,7 +15042,7 @@ option_value_following_option_type:
Not in trigger assigning value to new row, Not in trigger assigning value to new row,
and option_type preceding local variable is illegal. and option_type preceding local variable is illegal.
*/ */
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -15162,7 +15124,7 @@ option_value_no_option_type: ...@@ -15162,7 +15124,7 @@ option_value_no_option_type:
if (spc && spc->find_variable(names, false)) if (spc && spc->find_variable(names, false))
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str); my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
else else
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
...@@ -15269,7 +15231,7 @@ internal_variable_name: ...@@ -15269,7 +15231,7 @@ internal_variable_name:
LEX *lex= Lex; LEX *lex= Lex;
if (check_reserved_words(&$1)) if (check_reserved_words(&$1))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER && if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER &&
...@@ -15594,7 +15556,7 @@ revoke_command: ...@@ -15594,7 +15556,7 @@ revoke_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_REVOKE; lex->sql_command= SQLCOM_REVOKE;
...@@ -15605,7 +15567,7 @@ revoke_command: ...@@ -15605,7 +15567,7 @@ revoke_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_REVOKE; lex->sql_command= SQLCOM_REVOKE;
...@@ -15656,7 +15618,7 @@ grant_command: ...@@ -15656,7 +15618,7 @@ grant_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_GRANT; lex->sql_command= SQLCOM_GRANT;
...@@ -15668,7 +15630,7 @@ grant_command: ...@@ -15668,7 +15630,7 @@ grant_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_GRANT; lex->sql_command= SQLCOM_GRANT;
...@@ -16317,7 +16279,7 @@ subselect_start: ...@@ -16317,7 +16279,7 @@ subselect_start:
if (!lex->expr_allows_subselect || if (!lex->expr_allows_subselect ||
lex->sql_command == (int)SQLCOM_PURGE) lex->sql_command == (int)SQLCOM_PURGE)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
/* /*
......
...@@ -99,7 +99,7 @@ int yylex(void *yylval, void *yythd); ...@@ -99,7 +99,7 @@ int yylex(void *yylval, void *yythd);
#define MYSQL_YYABORT_UNLESS(A) \ #define MYSQL_YYABORT_UNLESS(A) \
if (!(A)) \ if (!(A)) \
{ \ { \
my_parse_error(thd, ER_SYNTAX_ERROR); \ thd->parse_error(); \
MYSQL_YYABORT; \ MYSQL_YYABORT; \
} }
...@@ -112,37 +112,6 @@ int yylex(void *yylval, void *yythd); ...@@ -112,37 +112,6 @@ int yylex(void *yylval, void *yythd);
#define YYDEBUG 0 #define YYDEBUG 0
#endif #endif
/**
@brief Push an error message into MySQL error stack with line
and position information.
This function provides semantic action implementers with a way
to push the famous "You have a syntax error near..." error
message into the error stack, which is normally produced only if
a parse error is discovered internally by the Bison generated
parser.
*/
static void my_parse_error_intern(THD *thd, const char *err_text,
const char *yytext)
{
Lex_input_stream *lip= &thd->m_parser_state->m_lip;
if (!yytext)
{
if (!(yytext= lip->get_tok_start()))
yytext= "";
}
/* Push an error into the error stack */
ErrConvString err(yytext, strlen(yytext),
thd->variables.character_set_client);
my_error(ER_PARSE_ERROR, MYF(0), err_text, err.ptr(), lip->yylineno);
}
static void my_parse_error(THD *thd, uint err_number, const char *yytext=0)
{
return my_parse_error_intern(thd, ER_THD(thd, err_number), yytext);
}
/** /**
@brief Bison callback to report a syntax/OOM error @brief Bison callback to report a syntax/OOM error
...@@ -159,7 +128,7 @@ static void my_parse_error(THD *thd, uint err_number, const char *yytext=0) ...@@ -159,7 +128,7 @@ static void my_parse_error(THD *thd, uint err_number, const char *yytext=0)
This function is not for use in semantic actions and is internal to This function is not for use in semantic actions and is internal to
the parser, as it performs some pre-return cleanup. the parser, as it performs some pre-return cleanup.
In semantic actions, please use my_parse_error or my_error to In semantic actions, please use thd->parse_error() or my_error to
push an error into the error stack and MYSQL_YYABORT push an error into the error stack and MYSQL_YYABORT
to abort from the parser. to abort from the parser.
*/ */
...@@ -176,7 +145,7 @@ void ORAerror(THD *thd, const char *s) ...@@ -176,7 +145,7 @@ void ORAerror(THD *thd, const char *s)
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */ /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0) if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s= ER_THD(thd, ER_SYNTAX_ERROR); s= ER_THD(thd, ER_SYNTAX_ERROR);
my_parse_error_intern(thd, s, 0); thd->parse_error(s, 0);
} }
...@@ -2901,7 +2870,7 @@ signal_allowed_expr: ...@@ -2901,7 +2870,7 @@ signal_allowed_expr:
SIGNAL/RESIGNAL ... SIGNAL/RESIGNAL ...
SET <signal condition item name> = @foo := expr SET <signal condition item name> = @foo := expr
*/ */
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4394,7 +4363,7 @@ partition_entry: ...@@ -4394,7 +4363,7 @@ partition_entry:
LEX *lex= Lex; LEX *lex= Lex;
if (!lex->part_info) if (!lex->part_info)
{ {
my_parse_error(thd, ER_PARTITION_ENTRY_ERROR); thd->parse_error(ER_PARTITION_ENTRY_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
/* /*
...@@ -4451,7 +4420,7 @@ opt_key_algo: ...@@ -4451,7 +4420,7 @@ opt_key_algo:
Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55; Lex->part_info->key_algorithm= partition_info::KEY_ALGORITHM_55;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4567,7 +4536,7 @@ part_func_expr: ...@@ -4567,7 +4536,7 @@ part_func_expr:
{ {
if (!Lex->safe_to_cache_query) if (!Lex->safe_to_cache_query)
{ {
my_parse_error(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR); thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
$$=$1; $$=$1;
...@@ -4607,7 +4576,7 @@ part_defs: ...@@ -4607,7 +4576,7 @@ part_defs:
if (part_info->num_parts != if (part_info->num_parts !=
count_curr_parts) count_curr_parts)
{ {
my_parse_error(thd, ER_PARTITION_WRONG_NO_PART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_PART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4737,7 +4706,7 @@ part_func_max: ...@@ -4737,7 +4706,7 @@ part_func_max:
part_info->num_columns != 1U) part_info->num_columns != 1U)
{ {
part_info->print_debug("Kilroy II", NULL); part_info->print_debug("Kilroy II", NULL);
my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR); thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
else else
...@@ -4768,7 +4737,7 @@ part_values_in: ...@@ -4768,7 +4737,7 @@ part_values_in:
part_info->num_columns > MAX_REF_PARTS) part_info->num_columns > MAX_REF_PARTS)
{ {
part_info->print_debug("Kilroy III", NULL); part_info->print_debug("Kilroy III", NULL);
my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR); thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
/* /*
...@@ -4789,7 +4758,7 @@ part_values_in: ...@@ -4789,7 +4758,7 @@ part_values_in:
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (part_info->num_columns < 2U) if (part_info->num_columns < 2U)
{ {
my_parse_error(thd, ER_ROW_SINGLE_PARTITION_FIELD_ERROR); thd->parse_error(ER_ROW_SINGLE_PARTITION_FIELD_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4830,7 +4799,7 @@ part_value_item: ...@@ -4830,7 +4799,7 @@ part_value_item:
error. error.
*/ */
part_info->print_debug("Kilroy I", NULL); part_info->print_debug("Kilroy I", NULL);
my_parse_error(thd, ER_PARTITION_COLUMN_LIST_ERROR); thd->parse_error(ER_PARTITION_COLUMN_LIST_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
part_info->curr_list_object= 0; part_info->curr_list_object= 0;
...@@ -4848,7 +4817,7 @@ part_value_expr_item: ...@@ -4848,7 +4817,7 @@ part_value_expr_item:
partition_info *part_info= Lex->part_info; partition_info *part_info= Lex->part_info;
if (part_info->part_type == LIST_PARTITION) if (part_info->part_type == LIST_PARTITION)
{ {
my_parse_error(thd, ER_MAXVALUE_IN_VALUES_IN); thd->parse_error(ER_MAXVALUE_IN_VALUES_IN);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (part_info->add_max_value(thd)) if (part_info->add_max_value(thd))
...@@ -4864,7 +4833,7 @@ part_value_expr_item: ...@@ -4864,7 +4833,7 @@ part_value_expr_item:
if (!lex->safe_to_cache_query) if (!lex->safe_to_cache_query)
{ {
my_parse_error(thd, ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR); thd->parse_error(ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (part_info->add_column_list_value(thd, part_expr)) if (part_info->add_column_list_value(thd, part_expr))
...@@ -4886,7 +4855,7 @@ opt_sub_partition: ...@@ -4886,7 +4855,7 @@ opt_sub_partition:
We come here when we have defined subpartitions on the first We come here when we have defined subpartitions on the first
partition but not on all the subsequent partitions. partition but not on all the subsequent partitions.
*/ */
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4898,7 +4867,7 @@ opt_sub_partition: ...@@ -4898,7 +4867,7 @@ opt_sub_partition:
if (part_info->num_subparts != if (part_info->num_subparts !=
part_info->count_curr_subparts) part_info->count_curr_subparts)
{ {
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4906,7 +4875,7 @@ opt_sub_partition: ...@@ -4906,7 +4875,7 @@ opt_sub_partition:
{ {
if (part_info->partitions.elements > 1) if (part_info->partitions.elements > 1)
{ {
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
part_info->num_subparts= part_info->count_curr_subparts; part_info->num_subparts= part_info->count_curr_subparts;
...@@ -4941,7 +4910,7 @@ sub_part_definition: ...@@ -4941,7 +4910,7 @@ sub_part_definition:
the second partition (the current partition processed the second partition (the current partition processed
have already been put into the partitions list. have already been put into the partitions list.
*/ */
my_parse_error(thd, ER_PARTITION_WRONG_NO_SUBPART_ERROR); thd->parse_error(ER_PARTITION_WRONG_NO_SUBPART_ERROR);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (!sub_p_elem || if (!sub_p_elem ||
...@@ -5175,7 +5144,7 @@ create_table_option: ...@@ -5175,7 +5144,7 @@ create_table_option:
Lex->create_info.table_options|= HA_OPTION_PACK_KEYS; Lex->create_info.table_options|= HA_OPTION_PACK_KEYS;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS; Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
...@@ -5196,7 +5165,7 @@ create_table_option: ...@@ -5196,7 +5165,7 @@ create_table_option:
Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_ON; Lex->create_info.stats_auto_recalc= HA_STATS_AUTO_RECALC_ON;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.used_fields|= HA_CREATE_USED_STATS_AUTO_RECALC; Lex->create_info.used_fields|= HA_CREATE_USED_STATS_AUTO_RECALC;
...@@ -5216,7 +5185,7 @@ create_table_option: ...@@ -5216,7 +5185,7 @@ create_table_option:
Lex->create_info.table_options|= HA_OPTION_STATS_PERSISTENT; Lex->create_info.table_options|= HA_OPTION_STATS_PERSISTENT;
break; break;
default: default:
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.used_fields|= HA_CREATE_USED_STATS_PERSISTENT; Lex->create_info.used_fields|= HA_CREATE_USED_STATS_PERSISTENT;
...@@ -5239,7 +5208,7 @@ create_table_option: ...@@ -5239,7 +5208,7 @@ create_table_option:
we can store the higher bits from stats_sample_pages in .frm too. */ we can store the higher bits from stats_sample_pages in .frm too. */
if ($3 == 0 || $3 > 0xffff) if ($3 == 0 || $3 > 0xffff)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.stats_sample_pages=$3; Lex->create_info.stats_sample_pages=$3;
...@@ -6236,7 +6205,7 @@ ws_nweights: ...@@ -6236,7 +6205,7 @@ ws_nweights:
{ {
if ($2 == 0) if ($2 == 0)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -6730,7 +6699,7 @@ alter: ...@@ -6730,7 +6699,7 @@ alter:
{ {
if (!($7 || $8 || $9 || $10 || $11)) if (!($7 || $8 || $9 || $10 || $11))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
/* /*
...@@ -7369,7 +7338,7 @@ start: ...@@ -7369,7 +7338,7 @@ start:
if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) && if (($3 & MYSQL_START_TRANS_OPT_READ_WRITE) &&
($3 & MYSQL_START_TRANS_OPT_READ_ONLY)) ($3 & MYSQL_START_TRANS_OPT_READ_ONLY))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->start_transaction_opt= $3; lex->start_transaction_opt= $3;
...@@ -9623,7 +9592,7 @@ function_call_generic: ...@@ -9623,7 +9592,7 @@ function_call_generic:
{ {
if (lex->current_select->inc_in_sum_expr()) if (lex->current_select->inc_in_sum_expr())
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10106,7 +10075,7 @@ variable_aux: ...@@ -10106,7 +10075,7 @@ variable_aux:
/* disallow "SELECT @@global.global.variable" */ /* disallow "SELECT @@global.global.variable" */
if ($3.str && $4.str && check_reserved_words(&$3)) if ($3.str && $4.str && check_reserved_words(&$3))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (!($$= get_system_var(thd, $2, $3, $4))) if (!($$= get_system_var(thd, $2, $3, $4)))
...@@ -10149,7 +10118,7 @@ in_sum_expr: ...@@ -10149,7 +10118,7 @@ in_sum_expr:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->current_select->inc_in_sum_expr()) if (lex->current_select->inc_in_sum_expr())
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10268,7 +10237,7 @@ table_ref: ...@@ -10268,7 +10237,7 @@ table_ref:
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(thd))) if (!($$= lex->current_select->nest_last_join(thd)))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10545,7 +10514,7 @@ table_primary_derived: ...@@ -10545,7 +10514,7 @@ table_primary_derived:
Tables with or without joins within parentheses cannot Tables with or without joins within parentheses cannot
have aliases, and we ruled out derived tables above. have aliases, and we ruled out derived tables above.
*/ */
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
else else
...@@ -10610,7 +10579,7 @@ select_derived_union: ...@@ -10610,7 +10579,7 @@ select_derived_union:
{ {
if ($1) if ($1)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10618,7 +10587,7 @@ select_derived_union: ...@@ -10618,7 +10587,7 @@ select_derived_union:
{ {
if ($1) if ($1)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10674,7 +10643,7 @@ select_derived: ...@@ -10674,7 +10643,7 @@ select_derived:
MYSQL_YYABORT; MYSQL_YYABORT;
if (!$2 && $$) if (!$2 && $$)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -10701,7 +10670,7 @@ select_derived2: ...@@ -10701,7 +10670,7 @@ select_derived2:
if (!lex->expr_allows_subselect || if (!lex->expr_allows_subselect ||
lex->sql_command == (int)SQLCOM_PURGE) lex->sql_command == (int)SQLCOM_PURGE)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
...@@ -11363,8 +11332,8 @@ delete_limit_clause: ...@@ -11363,8 +11332,8 @@ delete_limit_clause:
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT); Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_LIMIT);
sel->explicit_limit= 1; sel->explicit_limit= 1;
} }
| LIMIT ROWS_SYM EXAMINED_SYM { my_parse_error(thd, ER_SYNTAX_ERROR); MYSQL_YYABORT; } | LIMIT ROWS_SYM EXAMINED_SYM { thd->parse_error(); MYSQL_YYABORT; }
| LIMIT limit_option ROWS_SYM EXAMINED_SYM { my_parse_error(thd, ER_SYNTAX_ERROR); MYSQL_YYABORT; } | LIMIT limit_option ROWS_SYM EXAMINED_SYM { thd->parse_error(); MYSQL_YYABORT; }
; ;
int_num: int_num:
...@@ -11408,7 +11377,7 @@ real_ulonglong_num: ...@@ -11408,7 +11377,7 @@ real_ulonglong_num:
dec_num_error: dec_num_error:
dec_num dec_num
{ my_parse_error(thd, ER_ONLY_INTEGERS_ALLOWED); } { thd->parse_error(ER_ONLY_INTEGERS_ALLOWED); }
; ;
dec_num: dec_num:
...@@ -12562,12 +12531,12 @@ show_param: ...@@ -12562,12 +12531,12 @@ show_param:
ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str, &in_plugin); ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str, &in_plugin);
if (!table || !table->old_format || !in_plugin) if (!table || !table->old_format || !in_plugin)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR, $2); thd->parse_error(ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (lex->wild && table->idx_field1 < 0) if (lex->wild && table->idx_field1 < 0)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR, $3); thd->parse_error(ER_SYNTAX_ERROR, $3);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (make_schema_select(thd, Lex->current_select, table)) if (make_schema_select(thd, Lex->current_select, table))
...@@ -12768,7 +12737,7 @@ flush_lock: ...@@ -12768,7 +12737,7 @@ flush_lock:
{ {
if (Lex->query_tables == NULL) // Table list can't be empty if (Lex->query_tables == NULL) // Table list can't be empty
{ {
my_parse_error(thd, ER_NO_TABLES_USED); thd->parse_error(ER_NO_TABLES_USED);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->type|= REFRESH_FOR_EXPORT; Lex->type|= REFRESH_FOR_EXPORT;
...@@ -12833,7 +12802,7 @@ flush_option: ...@@ -12833,7 +12802,7 @@ flush_option:
ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str); ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str);
if (!table || !table->reset_table) if (!table || !table->reset_table)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR, $2); thd->parse_error(ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT; MYSQL_YYABORT;
} }
Lex->view_list.push_back((LEX_STRING*) Lex->view_list.push_back((LEX_STRING*)
...@@ -14561,7 +14530,7 @@ option_value_following_option_type: ...@@ -14561,7 +14530,7 @@ option_value_following_option_type:
Not in trigger assigning value to new row, Not in trigger assigning value to new row,
and option_type preceding local variable is illegal. and option_type preceding local variable is illegal.
*/ */
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -14643,7 +14612,7 @@ option_value_no_option_type: ...@@ -14643,7 +14612,7 @@ option_value_no_option_type:
if (spc && spc->find_variable(names, false)) if (spc && spc->find_variable(names, false))
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str); my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
else else
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
...@@ -14750,7 +14719,7 @@ internal_variable_name: ...@@ -14750,7 +14719,7 @@ internal_variable_name:
LEX *lex= Lex; LEX *lex= Lex;
if (check_reserved_words(&$1)) if (check_reserved_words(&$1))
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER && if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER &&
...@@ -15075,7 +15044,7 @@ revoke_command: ...@@ -15075,7 +15044,7 @@ revoke_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_REVOKE; lex->sql_command= SQLCOM_REVOKE;
...@@ -15086,7 +15055,7 @@ revoke_command: ...@@ -15086,7 +15055,7 @@ revoke_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_REVOKE; lex->sql_command= SQLCOM_REVOKE;
...@@ -15137,7 +15106,7 @@ grant_command: ...@@ -15137,7 +15106,7 @@ grant_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_GRANT; lex->sql_command= SQLCOM_GRANT;
...@@ -15149,7 +15118,7 @@ grant_command: ...@@ -15149,7 +15118,7 @@ grant_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_GRANT; lex->sql_command= SQLCOM_GRANT;
...@@ -15798,7 +15767,7 @@ subselect_start: ...@@ -15798,7 +15767,7 @@ subselect_start:
if (!lex->expr_allows_subselect || if (!lex->expr_allows_subselect ||
lex->sql_command == (int)SQLCOM_PURGE) lex->sql_command == (int)SQLCOM_PURGE)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR); thd->parse_error();
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