make all "artificial" syntax errors to report a place where they take place ("...syntax error ... near ...")

This commit is contained in:
unknown 2004-02-12 18:37:15 +01:00
parent 6ea5d81a5f
commit c5bc73e9a7

View File

@ -2157,13 +2157,13 @@ select_init:
SELECT_LEX * sel= lex->current_select; SELECT_LEX * sel= lex->current_select;
if (sel->set_braces(1)) if (sel->set_braces(1))
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
if (sel->linkage == UNION_TYPE && if (sel->linkage == UNION_TYPE &&
!sel->master_unit()->first_select()->braces) !sel->master_unit()->first_select()->braces)
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
/* select in braces, can't contain global parameters */ /* select in braces, can't contain global parameters */
@ -2179,13 +2179,13 @@ select_init2:
SELECT_LEX * sel= lex->current_select; SELECT_LEX * sel= lex->current_select;
if (lex->current_select->set_braces(0)) if (lex->current_select->set_braces(0))
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
if (sel->linkage == UNION_TYPE && if (sel->linkage == UNION_TYPE &&
sel->master_unit()->first_select()->braces) sel->master_unit()->first_select()->braces)
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
} }
@ -2742,7 +2742,7 @@ simple_expr:
{ {
if ($1->type() != Item::ROW_ITEM) if ($1->type() != Item::ROW_ITEM)
{ {
send_error(Lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
$$= new Item_func_interval((Item_row *)$1); $$= new Item_func_interval((Item_row *)$1);
@ -3078,7 +3078,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())
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
} }
@ -3250,7 +3250,7 @@ select_derived:
lex->sql_command <= (int)SQLCOM_HA_READ) || lex->sql_command <= (int)SQLCOM_HA_READ) ||
lex->sql_command == (int)SQLCOM_KILL) lex->sql_command == (int)SQLCOM_KILL)
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
@ -3885,7 +3885,7 @@ opt_insert_update:
for a moment */ for a moment */
if (Lex->sql_command != SQLCOM_INSERT) if (Lex->sql_command != SQLCOM_INSERT)
{ {
send_error(Lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
} }
@ -4491,7 +4491,7 @@ param_marker:
} }
else else
{ {
yyerror("You have an error in your SQL syntax"); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
} }
@ -5534,7 +5534,7 @@ union_list:
} }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
if (mysql_new_select(lex, 0)) if (mysql_new_select(lex, 0))
@ -5635,7 +5635,7 @@ subselect_start:
lex->sql_command <= (int)SQLCOM_HA_READ) || lex->sql_command <= (int)SQLCOM_HA_READ) ||
lex->sql_command == (int)SQLCOM_KILL) lex->sql_command == (int)SQLCOM_KILL)
{ {
send_error(lex->thd, ER_SYNTAX_ERROR); yyerror(ER(ER_SYNTAX_ERROR));
YYABORT; YYABORT;
} }
if (mysql_new_select(Lex, 1)) if (mysql_new_select(Lex, 1))