Commit c2e0e5af authored by kostja@bodhi.local's avatar kostja@bodhi.local

Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime

into  bodhi.local:/opt/local/work/mysql-5.0-26750
parents 82c1c023 86f02cd3
...@@ -3114,8 +3114,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -3114,8 +3114,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
ex.skip_lines = skip_lines; ex.skip_lines = skip_lines;
List<Item> field_list; List<Item> field_list;
thd->main_lex.select_lex.context.resolve_in_table_list_only(&tables); thd->lex->select_lex.context.resolve_in_table_list_only(&tables);
set_fields(tables.db, field_list, &thd->main_lex.select_lex.context); set_fields(tables.db, field_list, &thd->lex->select_lex.context);
thd->variables.pseudo_thread_id= thread_id; thd->variables.pseudo_thread_id= thread_id;
if (net) if (net)
{ {
......
...@@ -1598,18 +1598,6 @@ static void network_init(void) ...@@ -1598,18 +1598,6 @@ static void network_init(void)
#endif /*!EMBEDDED_LIBRARY*/ #endif /*!EMBEDDED_LIBRARY*/
void MYSQLerror(const char *s)
{
THD *thd=current_thd;
char *yytext= (char*) thd->lex->tok_start;
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s=ER(ER_SYNTAX_ERROR);
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
(yytext ? (char*) yytext : ""),
thd->lex->yylineno);
}
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
/* /*
......
...@@ -166,14 +166,10 @@ Open_tables_state::Open_tables_state(ulong version_arg) ...@@ -166,14 +166,10 @@ Open_tables_state::Open_tables_state(ulong version_arg)
} }
/*
Pass nominal parameters to Statement constructor only to ensure that
the destructor works OK in case of error. The main_mem_root will be
re-initialized in init().
*/
THD::THD() THD::THD()
:Statement(CONVENTIONAL_EXECUTION, 0, ALLOC_ROOT_MIN_BLOCK_SIZE, 0), :Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
/* statement id */ 0),
Open_tables_state(refresh_version), Open_tables_state(refresh_version),
lock_id(&main_lock_id), lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0), user_time(0), in_sub_stmt(0), global_read_lock(0), is_fatal_error(0),
...@@ -184,6 +180,12 @@ THD::THD() ...@@ -184,6 +180,12 @@ THD::THD()
{ {
ulong tmp; ulong tmp;
/*
Pass nominal parameters to init_alloc_root only to ensure that
the destructor works OK in case of an error. The main_mem_root
will be re-initialized in init_for_queries().
*/
init_sql_alloc(&main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
stmt_arena= this; stmt_arena= this;
thread_stack= 0; thread_stack= 0;
db= 0; db= 0;
...@@ -475,6 +477,7 @@ THD::~THD() ...@@ -475,6 +477,7 @@ THD::~THD()
#ifndef DBUG_OFF #ifndef DBUG_OFF
dbug_sentry= THD_SENTRY_GONE; dbug_sentry= THD_SENTRY_GONE;
#endif #endif
free_root(&main_mem_root, MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -1613,18 +1616,17 @@ void Query_arena::cleanup_stmt() ...@@ -1613,18 +1616,17 @@ void Query_arena::cleanup_stmt()
Statement functions Statement functions
*/ */
Statement::Statement(enum enum_state state_arg, ulong id_arg, Statement::Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
ulong alloc_block_size, ulong prealloc_size) enum enum_state state_arg, ulong id_arg)
:Query_arena(&main_mem_root, state_arg), :Query_arena(mem_root_arg, state_arg),
id(id_arg), id(id_arg),
set_query_id(1), set_query_id(1),
lex(&main_lex), lex(lex_arg),
query(0), query(0),
query_length(0), query_length(0),
cursor(0) cursor(0)
{ {
name.str= NULL; name.str= NULL;
init_sql_alloc(&main_mem_root, alloc_block_size, prealloc_size);
} }
...@@ -1666,7 +1668,7 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup) ...@@ -1666,7 +1668,7 @@ void Statement::restore_backup_statement(Statement *stmt, Statement *backup)
void THD::end_statement() void THD::end_statement()
{ {
/* Cleanup SQL processing state to resuse this statement in next query. */ /* Cleanup SQL processing state to reuse this statement in next query. */
lex_end(lex); lex_end(lex);
delete lex->result; delete lex->result;
lex->result= 0; lex->result= 0;
...@@ -1707,12 +1709,6 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup) ...@@ -1707,12 +1709,6 @@ void THD::restore_active_arena(Query_arena *set, Query_arena *backup)
Statement::~Statement() Statement::~Statement()
{ {
/*
We must free `main_mem_root', not `mem_root' (pointer), to work
correctly if this statement is used as a backup statement,
for which `mem_root' may point to some other statement.
*/
free_root(&main_mem_root, MYF(0));
} }
C_MODE_START C_MODE_START
......
...@@ -753,8 +753,10 @@ class Query_arena ...@@ -753,8 +753,10 @@ class Query_arena
class Server_side_cursor; class Server_side_cursor;
/* /**
State of a single command executed against this connection. @class Statement
@brief State of a single command executed against this connection.
One connection can contain a lot of simultaneously running statements, One connection can contain a lot of simultaneously running statements,
some of which could be: some of which could be:
- prepared, that is, contain placeholders, - prepared, that is, contain placeholders,
...@@ -772,10 +774,6 @@ class Statement: public ilink, public Query_arena ...@@ -772,10 +774,6 @@ class Statement: public ilink, public Query_arena
Statement(const Statement &rhs); /* not implemented: */ Statement(const Statement &rhs); /* not implemented: */
Statement &operator=(const Statement &rhs); /* non-copyable */ Statement &operator=(const Statement &rhs); /* non-copyable */
public: public:
/* FIXME: these must be protected */
MEM_ROOT main_mem_root;
LEX main_lex;
/* /*
Uniquely identifies each statement object in thread scope; change during Uniquely identifies each statement object in thread scope; change during
statement lifetime. FIXME: must be const statement lifetime. FIXME: must be const
...@@ -819,10 +817,10 @@ class Statement: public ilink, public Query_arena ...@@ -819,10 +817,10 @@ class Statement: public ilink, public Query_arena
public: public:
/* This constructor is called for backup statements */ /* This constructor is called for backup statements */
Statement() { clear_alloc_root(&main_mem_root); } Statement() {}
Statement(enum enum_state state_arg, ulong id_arg, Statement(LEX *lex_arg, MEM_ROOT *mem_root_arg,
ulong alloc_block_size, ulong prealloc_size); enum enum_state state_arg, ulong id_arg);
virtual ~Statement(); virtual ~Statement();
/* Assign execution context (note: not all members) of given stmt to self */ /* Assign execution context (note: not all members) of given stmt to self */
...@@ -834,7 +832,7 @@ class Statement: public ilink, public Query_arena ...@@ -834,7 +832,7 @@ class Statement: public ilink, public Query_arena
}; };
/* /**
Container for all statements created/used in a connection. Container for all statements created/used in a connection.
Statements in Statement_map have unique Statement::id (guaranteed by id Statements in Statement_map have unique Statement::id (guaranteed by id
assignment in Statement::Statement) assignment in Statement::Statement)
...@@ -914,6 +912,10 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state); ...@@ -914,6 +912,10 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state);
bool xid_cache_insert(XID_STATE *xid_state); bool xid_cache_insert(XID_STATE *xid_state);
void xid_cache_delete(XID_STATE *xid_state); void xid_cache_delete(XID_STATE *xid_state);
/**
@class Security_context
@brief A set of THD members describing the current authenticated user.
*/
class Security_context { class Security_context {
public: public:
...@@ -943,7 +945,7 @@ class Security_context { ...@@ -943,7 +945,7 @@ class Security_context {
}; };
/* /**
A registry for item tree transformations performed during A registry for item tree transformations performed during
query optimization. We register only those changes which require query optimization. We register only those changes which require
a rollback to re-execute a prepared statement or stored procedure a rollback to re-execute a prepared statement or stored procedure
...@@ -954,7 +956,7 @@ struct Item_change_record; ...@@ -954,7 +956,7 @@ struct Item_change_record;
typedef I_List<Item_change_record> Item_change_list; typedef I_List<Item_change_record> Item_change_list;
/* /**
Type of prelocked mode. Type of prelocked mode.
See comment for THD::prelocked_mode for complete description. See comment for THD::prelocked_mode for complete description.
*/ */
...@@ -963,7 +965,7 @@ enum prelocked_mode_type {NON_PRELOCKED= 0, PRELOCKED= 1, ...@@ -963,7 +965,7 @@ enum prelocked_mode_type {NON_PRELOCKED= 0, PRELOCKED= 1,
PRELOCKED_UNDER_LOCK_TABLES= 2}; PRELOCKED_UNDER_LOCK_TABLES= 2};
/* /**
Class that holds information about tables which were opened and locked Class that holds information about tables which were opened and locked
by the thread. It is also used to save/restore this information in by the thread. It is also used to save/restore this information in
push_open_tables_state()/pop_open_tables_state(). push_open_tables_state()/pop_open_tables_state().
...@@ -1048,14 +1050,17 @@ class Open_tables_state ...@@ -1048,14 +1050,17 @@ class Open_tables_state
} }
}; };
/**
/* class to save context when executing a function or trigger */ @class Sub_statement_state
@brief Used to save context when executing a function or trigger
*/
/* Defines used for Sub_statement_state::in_sub_stmt */ /* Defines used for Sub_statement_state::in_sub_stmt */
#define SUB_STMT_TRIGGER 1 #define SUB_STMT_TRIGGER 1
#define SUB_STMT_FUNCTION 2 #define SUB_STMT_FUNCTION 2
class Sub_statement_state class Sub_statement_state
{ {
public: public:
...@@ -1114,7 +1119,8 @@ class Internal_error_handler ...@@ -1114,7 +1119,8 @@ class Internal_error_handler
}; };
/* /**
@class THD
For each client connection we create a separate thread with THD serving as For each client connection we create a separate thread with THD serving as
a thread/connection descriptor a thread/connection descriptor
*/ */
...@@ -1726,6 +1732,22 @@ class THD :public Statement, ...@@ -1726,6 +1732,22 @@ class THD :public Statement,
private: private:
/** The current internal error handler for this thread, or NULL. */ /** The current internal error handler for this thread, or NULL. */
Internal_error_handler *m_internal_handler; Internal_error_handler *m_internal_handler;
/**
The lex to hold the parsed tree of conventional (non-prepared) queries.
Whereas for prepared and stored procedure statements we use an own lex
instance for each new query, for conventional statements we reuse
the same lex. (@see mysql_parse for details).
*/
LEX main_lex;
/**
This memory root is used for two purposes:
- for conventional queries, to allocate structures stored in main_lex
during parsing, and allocate runtime data (execution plan, etc.)
during execution.
- for prepared queries, only to allocate runtime data. The parsed
tree itself is reused between executions and thus is stored elsewhere.
*/
MEM_ROOT main_mem_root;
}; };
......
...@@ -1648,6 +1648,36 @@ void st_select_lex::print_limit(THD *thd, String *str) ...@@ -1648,6 +1648,36 @@ void st_select_lex::print_limit(THD *thd, String *str)
} }
} }
/**
@brief Restore the LEX and THD in case of a parse error.
This is a clean up call that is invoked by the Bison generated
parser before returning an error from MYSQLparse. If your
semantic actions manipulate with the global thread state (which
is a very bad practice and should not normally be employed) and
need a clean-up in case of error, and you can not use %destructor
rule in the grammar file itself, this function should be used
to implement the clean up.
*/
void st_lex::cleanup_lex_after_parse_error(THD *thd)
{
/*
Delete sphead for the side effect of restoring of the original
LEX state, thd->lex, thd->mem_root and thd->free_list if they
were replaced when parsing stored procedure statements. We
will never use sphead object after a parse error, so it's okay
to delete it only for the sake of the side effect.
TODO: make this functionality explicit in sp_head class.
Sic: we must nullify the member of the main lex, not the
current one that will be thrown away
*/
if (thd->lex->sphead);
{
delete thd->lex->sphead;
thd->lex->sphead= NULL;
}
}
/* /*
Initialize (or reset) Query_tables_list object. Initialize (or reset) Query_tables_list object.
......
...@@ -1182,6 +1182,10 @@ typedef struct st_lex : public Query_tables_list ...@@ -1182,6 +1182,10 @@ typedef struct st_lex : public Query_tables_list
{ {
return context_stack.head(); return context_stack.head();
} }
/*
Restore the LEX and THD in case of a parse error.
*/
static void cleanup_lex_after_parse_error(THD *thd);
void reset_n_backup_query_tables_list(Query_tables_list *backup); void reset_n_backup_query_tables_list(Query_tables_list *backup);
void restore_backup_query_tables_list(Query_tables_list *backup); void restore_backup_query_tables_list(Query_tables_list *backup);
......
...@@ -4506,9 +4506,6 @@ mysql_execute_command(THD *thd) ...@@ -4506,9 +4506,6 @@ mysql_execute_command(THD *thd)
clean up the environment. clean up the environment.
*/ */
create_sp_error: create_sp_error:
lex->unit.cleanup();
delete lex->sphead;
lex->sphead= 0;
if (sp_result != SP_OK ) if (sp_result != SP_OK )
goto error; goto error;
send_ok(thd); send_ok(thd);
...@@ -4879,9 +4876,6 @@ mysql_execute_command(THD *thd) ...@@ -4879,9 +4876,6 @@ mysql_execute_command(THD *thd)
/* Conditionally writes to binlog. */ /* Conditionally writes to binlog. */
res= mysql_create_or_drop_trigger(thd, all_tables, 1); res= mysql_create_or_drop_trigger(thd, all_tables, 1);
/* We don't care about trigger body after this point */
delete lex->sphead;
lex->sphead= 0;
break; break;
} }
case SQLCOM_DROP_TRIGGER: case SQLCOM_DROP_TRIGGER:
...@@ -5904,15 +5898,7 @@ void mysql_parse(THD *thd, char *inBuf, uint length) ...@@ -5904,15 +5898,7 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
else else
#endif #endif
{ {
if (thd->net.report_error) if (! thd->net.report_error)
{
if (thd->lex->sphead)
{
delete thd->lex->sphead;
thd->lex->sphead= NULL;
}
}
else
{ {
/* /*
Binlog logs a string starting from thd->query and having length Binlog logs a string starting from thd->query and having length
...@@ -5932,7 +5918,6 @@ void mysql_parse(THD *thd, char *inBuf, uint length) ...@@ -5932,7 +5918,6 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
query_cache_end_of_result(thd); query_cache_end_of_result(thd);
} }
} }
lex->unit.cleanup();
} }
else else
{ {
...@@ -5940,19 +5925,14 @@ void mysql_parse(THD *thd, char *inBuf, uint length) ...@@ -5940,19 +5925,14 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
DBUG_PRINT("info",("Command aborted. Fatal_error: %d", DBUG_PRINT("info",("Command aborted. Fatal_error: %d",
thd->is_fatal_error)); thd->is_fatal_error));
/*
The first thing we do after parse error is freeing sp_head to
ensure that we have restored original memroot.
*/
if (thd->lex->sphead)
{
/* Clean up after failed stored procedure/function */
delete thd->lex->sphead;
thd->lex->sphead= NULL;
}
query_cache_abort(&thd->net); query_cache_abort(&thd->net);
lex->unit.cleanup();
} }
if (thd->lex->sphead)
{
delete thd->lex->sphead;
thd->lex->sphead= 0;
}
lex->unit.cleanup();
thd->proc_info="freeing items"; thd->proc_info="freeing items";
thd->end_statement(); thd->end_statement();
thd->cleanup_after_query(); thd->cleanup_after_query();
......
...@@ -99,9 +99,12 @@ class Select_fetch_protocol_prep: public select_send ...@@ -99,9 +99,12 @@ class Select_fetch_protocol_prep: public select_send
#endif #endif
}; };
/****************************************************************************** /****************************************************************************/
Prepared_statement: a statement that can contain placeholders
******************************************************************************/ /**
@class Prepared_statement
@brief Prepared_statement: a statement that can contain placeholders
*/
class Prepared_statement: public Statement class Prepared_statement: public Statement
{ {
...@@ -141,6 +144,16 @@ class Prepared_statement: public Statement ...@@ -141,6 +144,16 @@ class Prepared_statement: public Statement
bool execute(String *expanded_query, bool open_cursor); bool execute(String *expanded_query, bool open_cursor);
/* Destroy this statement */ /* Destroy this statement */
bool deallocate(); bool deallocate();
private:
/**
Store the parsed tree of a prepared statement here.
*/
LEX main_lex;
/**
The memory root to allocate parsed tree elements (instances of Item,
SELECT_LEX and other classes).
*/
MEM_ROOT main_mem_root;
}; };
...@@ -2034,6 +2047,7 @@ void mysql_sql_stmt_prepare(THD *thd) ...@@ -2034,6 +2047,7 @@ void mysql_sql_stmt_prepare(THD *thd)
delete stmt; delete stmt;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (thd->stmt_map.insert(thd, stmt)) if (thd->stmt_map.insert(thd, stmt))
{ {
/* The statement is deleted and an error is set if insert fails */ /* The statement is deleted and an error is set if insert fails */
...@@ -2629,17 +2643,18 @@ Select_fetch_protocol_prep::send_data(List<Item> &fields) ...@@ -2629,17 +2643,18 @@ Select_fetch_protocol_prep::send_data(List<Item> &fields)
****************************************************************************/ ****************************************************************************/
Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg) Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg)
:Statement(INITIALIZED, ++thd_arg->statement_id_counter, :Statement(&main_lex, &main_mem_root,
thd_arg->variables.query_alloc_block_size, INITIALIZED, ++thd_arg->statement_id_counter),
thd_arg->variables.query_prealloc_size),
thd(thd_arg), thd(thd_arg),
result(thd_arg), result(thd_arg),
protocol(protocol_arg), protocol(protocol_arg),
param_array(0), param_array(0),
param_count(0), param_count(0),
last_errno(0), last_errno(0),
flags((uint) IS_IN_USE) flags((uint) IS_IN_USE)
{ {
init_alloc_root(&main_mem_root, thd_arg->variables.query_alloc_block_size,
thd_arg->variables.query_prealloc_size);
*last_error= '\0'; *last_error= '\0';
} }
...@@ -2688,6 +2703,7 @@ Prepared_statement::~Prepared_statement() ...@@ -2688,6 +2703,7 @@ Prepared_statement::~Prepared_statement()
*/ */
free_items(); free_items();
delete lex->result; delete lex->result;
free_root(&main_mem_root, MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -2703,6 +2719,7 @@ void Prepared_statement::cleanup_stmt() ...@@ -2703,6 +2719,7 @@ void Prepared_statement::cleanup_stmt()
DBUG_ENTER("Prepared_statement::cleanup_stmt"); DBUG_ENTER("Prepared_statement::cleanup_stmt");
DBUG_PRINT("enter",("stmt: %p", this)); DBUG_PRINT("enter",("stmt: %p", this));
DBUG_ASSERT(lex->sphead == 0);
/* The order is important */ /* The order is important */
lex->unit.cleanup(); lex->unit.cleanup();
cleanup_items(free_list); cleanup_items(free_list);
...@@ -2789,15 +2806,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) ...@@ -2789,15 +2806,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
error= MYSQLparse((void *)thd) || thd->is_fatal_error || error= MYSQLparse((void *)thd) || thd->is_fatal_error ||
thd->net.report_error || init_param_array(this); thd->net.report_error || init_param_array(this);
/*
The first thing we do after parse error is freeing sp_head to
ensure that we have restored original memroot.
*/
if (error && lex->sphead)
{
delete lex->sphead;
lex->sphead= NULL;
}
/* /*
While doing context analysis of the query (in check_prepared_statement) While doing context analysis of the query (in check_prepared_statement)
we allocate a lot of additional memory: for open tables, JOINs, derived we allocate a lot of additional memory: for open tables, JOINs, derived
...@@ -2823,12 +2831,18 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) ...@@ -2823,12 +2831,18 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
if (error == 0) if (error == 0)
error= check_prepared_statement(this, name.str != 0); error= check_prepared_statement(this, name.str != 0);
/* Free sp_head if check_prepared_statement() failed. */ /*
if (error && lex->sphead) Currently CREATE PROCEDURE/TRIGGER/EVENT are prohibited in prepared
statements: ensure we have no memory leak here if by someone tries
to PREPARE stmt FROM "CREATE PROCEDURE ..."
*/
DBUG_ASSERT(lex->sphead == NULL || error != 0);
if (lex->sphead)
{ {
delete lex->sphead; delete lex->sphead;
lex->sphead= NULL; lex->sphead= NULL;
} }
lex_end(lex); lex_end(lex);
cleanup_stmt(); cleanup_stmt();
thd->restore_backup_statement(this, &stmt_backup); thd->restore_backup_statement(this, &stmt_backup);
......
...@@ -983,11 +983,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, ...@@ -983,11 +983,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
thd->spcont= 0; thd->spcont= 0;
if (MYSQLparse((void *)thd) || thd->is_fatal_error) if (MYSQLparse((void *)thd) || thd->is_fatal_error)
{ {
/* /* Currently sphead is always deleted in case of a parse error */
Free lex associated resources. DBUG_ASSERT(lex.sphead == 0);
QQ: Do we really need all this stuff here ?
*/
delete lex.sphead;
goto err_with_lex_cleanup; goto err_with_lex_cleanup;
} }
......
...@@ -52,11 +52,18 @@ const LEX_STRING null_lex_str={0,0}; ...@@ -52,11 +52,18 @@ const LEX_STRING null_lex_str={0,0};
ER_WARN_DEPRECATED_SYNTAX, \ ER_WARN_DEPRECATED_SYNTAX, \
ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B)); ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B));
#define YYABORT_UNLESS(A) \ #define MYSQL_YYABORT \
do \
{ \
LEX::cleanup_lex_after_parse_error(YYTHD);\
YYABORT; \
} while (0)
#define MYSQL_YYABORT_UNLESS(A) \
if (!(A)) \ if (!(A)) \
{ \ { \
yyerror(ER(ER_SYNTAX_ERROR)); \ my_parse_error(ER(ER_SYNTAX_ERROR));\
YYABORT; \ MYSQL_YYABORT; \
} }
#ifndef DBUG_OFF #ifndef DBUG_OFF
...@@ -65,6 +72,66 @@ const LEX_STRING null_lex_str={0,0}; ...@@ -65,6 +72,66 @@ const LEX_STRING null_lex_str={0,0};
#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.
*/
void my_parse_error(const char *s)
{
THD *thd= current_thd;
char *yytext= (char*) thd->lex->tok_start;
/* Push an error into the error stack */
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
(yytext ? (char*) yytext : ""),
thd->lex->yylineno);
}
/**
@brief Bison callback to report a syntax/OOM error
This function is invoked by the bison-generated parser
when a syntax error, a parse error or an out-of-memory
condition occurs. This function is not invoked when the
parser is requested to abort by semantic action code
by means of YYABORT or YYACCEPT macros. This is why these
macros should not be used (use MYSQL_YYABORT/MYSQL_YYACCEPT
instead).
The parser will abort immediately after invoking this callback.
This function is not for use in semantic actions and is internal to
the parser, as it performs some pre-return cleanup.
In semantic actions, please use my_parse_error or my_error to
push an error into the error stack and MYSQL_YYABORT
to abort from the parser.
*/
void MYSQLerror(const char *s)
{
THD *thd= current_thd;
/*
Restore the original LEX if it was replaced when parsing
a stored procedure. We must ensure that a parsing error
does not leave any side effects in the THD.
*/
LEX::cleanup_lex_after_parse_error(thd);
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s= ER(ER_SYNTAX_ERROR);
my_parse_error(s);
}
#ifndef DBUG_OFF #ifndef DBUG_OFF
void turn_parser_debug_on() void turn_parser_debug_on()
{ {
...@@ -1138,7 +1205,7 @@ query: ...@@ -1138,7 +1205,7 @@ query:
(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))) (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
{ {
my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0)); my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -1210,8 +1277,8 @@ deallocate: ...@@ -1210,8 +1277,8 @@ deallocate:
LEX *lex= thd->lex; LEX *lex= thd->lex;
if (lex->stmt_prepare_mode) if (lex->stmt_prepare_mode)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_DEALLOCATE_PREPARE; lex->sql_command= SQLCOM_DEALLOCATE_PREPARE;
lex->prepared_stmt_name= $3; lex->prepared_stmt_name= $3;
...@@ -1230,8 +1297,8 @@ prepare: ...@@ -1230,8 +1297,8 @@ prepare:
LEX *lex= thd->lex; LEX *lex= thd->lex;
if (lex->stmt_prepare_mode) if (lex->stmt_prepare_mode)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_PREPARE; lex->sql_command= SQLCOM_PREPARE;
lex->prepared_stmt_name= $2; lex->prepared_stmt_name= $2;
...@@ -1260,8 +1327,8 @@ execute: ...@@ -1260,8 +1327,8 @@ execute:
LEX *lex= thd->lex; LEX *lex= thd->lex;
if (lex->stmt_prepare_mode) if (lex->stmt_prepare_mode)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_EXECUTE; lex->sql_command= SQLCOM_EXECUTE;
lex->prepared_stmt_name= $2; lex->prepared_stmt_name= $2;
...@@ -1285,7 +1352,7 @@ execute_var_ident: '@' ident_or_text ...@@ -1285,7 +1352,7 @@ execute_var_ident: '@' ident_or_text
LEX *lex=Lex; LEX *lex=Lex;
LEX_STRING *lexstr= (LEX_STRING*)sql_memdup(&$2, sizeof(LEX_STRING)); LEX_STRING *lexstr= (LEX_STRING*)sql_memdup(&$2, sizeof(LEX_STRING));
if (!lexstr || lex->prepared_stmt_params.push_back(lexstr)) if (!lexstr || lex->prepared_stmt_params.push_back(lexstr))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -1297,7 +1364,7 @@ help: ...@@ -1297,7 +1364,7 @@ help:
if (Lex->sphead) if (Lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "HELP"); my_error(ER_SP_BADSTATEMENT, MYF(0), "HELP");
YYABORT; MYSQL_YYABORT;
} }
} }
ident_or_text ident_or_text
...@@ -1424,7 +1491,7 @@ create: ...@@ -1424,7 +1491,7 @@ create:
(using_update_log ? (using_update_log ?
TL_READ_NO_INSERT: TL_READ_NO_INSERT:
TL_READ))) TL_READ)))
YYABORT; MYSQL_YYABORT;
lex->alter_info.reset(); lex->alter_info.reset();
lex->col_list.empty(); lex->col_list.empty();
lex->change=NullS; lex->change=NullS;
...@@ -1442,7 +1509,7 @@ create: ...@@ -1442,7 +1509,7 @@ create:
lex->sql_command= SQLCOM_CREATE_INDEX; lex->sql_command= SQLCOM_CREATE_INDEX;
if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL, if (!lex->current_select->add_table_to_list(lex->thd, $7, NULL,
TL_OPTION_UPDATING)) TL_OPTION_UPDATING))
YYABORT; MYSQL_YYABORT;
lex->alter_info.reset(); lex->alter_info.reset();
lex->alter_info.flags= ALTER_ADD_INDEX; lex->alter_info.flags= ALTER_ADD_INDEX;
lex->col_list.empty(); lex->col_list.empty();
...@@ -1503,12 +1570,12 @@ sp_name: ...@@ -1503,12 +1570,12 @@ sp_name:
if (!$1.str || check_db_name($1.str)) if (!$1.str || check_db_name($1.str))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str); my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
if (check_routine_name($3)) if (check_routine_name($3))
{ {
my_error(ER_SP_WRONG_NAME, MYF(0), $3.str); my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
YYABORT; MYSQL_YYABORT;
} }
$$= new sp_name($1, $3); $$= new sp_name($1, $3);
$$->init_qname(YYTHD); $$->init_qname(YYTHD);
...@@ -1520,10 +1587,10 @@ sp_name: ...@@ -1520,10 +1587,10 @@ sp_name:
if (check_routine_name($1)) if (check_routine_name($1))
{ {
my_error(ER_SP_WRONG_NAME, MYF(0), $1.str); my_error(ER_SP_WRONG_NAME, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
if (thd->copy_db_to(&db.str, &db.length)) if (thd->copy_db_to(&db.str, &db.length))
YYABORT; MYSQL_YYABORT;
$$= new sp_name(db, $1); $$= new sp_name(db, $1);
if ($$) if ($$)
$$->init_qname(YYTHD); $$->init_qname(YYTHD);
...@@ -1543,7 +1610,7 @@ create_function_tail: ...@@ -1543,7 +1610,7 @@ create_function_tail:
and is considered a parsing error. and is considered a parsing error.
*/ */
my_error(ER_WRONG_USAGE, MYF(0), "SONAME", "DEFINER"); my_error(ER_WRONG_USAGE, MYF(0), "SONAME", "DEFINER");
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command = SQLCOM_CREATE_FUNCTION; lex->sql_command = SQLCOM_CREATE_FUNCTION;
lex->udf.name = lex->spname->m_name; lex->udf.name = lex->spname->m_name;
...@@ -1562,13 +1629,13 @@ create_function_tail: ...@@ -1562,13 +1629,13 @@ create_function_tail:
if (lex->udf.type == UDFTYPE_AGGREGATE) if (lex->udf.type == UDFTYPE_AGGREGATE)
{ {
my_error(ER_SP_NO_AGGREGATE, MYF(0)); my_error(ER_SP_NO_AGGREGATE, MYF(0));
YYABORT; MYSQL_YYABORT;
} }
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION"); my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
YYABORT; MYSQL_YYABORT;
} }
/* Order is important here: new - reset - init */ /* Order is important here: new - reset - init */
sp= new sp_head(); sp= new sp_head();
...@@ -1609,7 +1676,7 @@ create_function_tail: ...@@ -1609,7 +1676,7 @@ create_function_tail:
if (sp->fill_field_definition(YYTHD, lex, if (sp->fill_field_definition(YYTHD, lex,
(enum enum_field_types) $8, (enum enum_field_types) $8,
&sp->m_return_field_def)) &sp->m_return_field_def))
YYABORT; MYSQL_YYABORT;
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
} }
...@@ -1626,14 +1693,14 @@ create_function_tail: ...@@ -1626,14 +1693,14 @@ create_function_tail:
sp_head *sp= lex->sphead; sp_head *sp= lex->sphead;
if (sp->is_not_allowed_in_function("function")) if (sp->is_not_allowed_in_function("function"))
YYABORT; MYSQL_YYABORT;
lex->sql_command= SQLCOM_CREATE_SPFUNCTION; lex->sql_command= SQLCOM_CREATE_SPFUNCTION;
sp->init_strings(YYTHD, lex); sp->init_strings(YYTHD, lex);
if (!(sp->m_flags & sp_head::HAS_RETURN)) if (!(sp->m_flags & sp_head::HAS_RETURN))
{ {
my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str); my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str);
YYABORT; MYSQL_YYABORT;
} }
/* Restore flag if it was cleared above */ /* Restore flag if it was cleared above */
if (sp->m_old_cmq) if (sp->m_old_cmq)
...@@ -1763,7 +1830,7 @@ sp_fdparam: ...@@ -1763,7 +1830,7 @@ sp_fdparam:
if (spc->find_variable(&$1, TRUE)) if (spc->find_variable(&$1, TRUE))
{ {
my_error(ER_SP_DUP_PARAM, MYF(0), $1.str); my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
sp_variable_t *spvar= spc->push_variable(&$1, sp_variable_t *spvar= spc->push_variable(&$1,
(enum enum_field_types)$3, (enum enum_field_types)$3,
...@@ -1773,7 +1840,7 @@ sp_fdparam: ...@@ -1773,7 +1840,7 @@ sp_fdparam:
(enum enum_field_types) $3, (enum enum_field_types) $3,
&spvar->field_def)) &spvar->field_def))
{ {
YYABORT; MYSQL_YYABORT;
} }
spvar->field_def.field_name= spvar->name.str; spvar->field_def.field_name= spvar->name.str;
spvar->field_def.pack_flag |= FIELDFLAG_MAYBE_NULL; spvar->field_def.pack_flag |= FIELDFLAG_MAYBE_NULL;
...@@ -1800,7 +1867,7 @@ sp_pdparam: ...@@ -1800,7 +1867,7 @@ sp_pdparam:
if (spc->find_variable(&$3, TRUE)) if (spc->find_variable(&$3, TRUE))
{ {
my_error(ER_SP_DUP_PARAM, MYF(0), $3.str); my_error(ER_SP_DUP_PARAM, MYF(0), $3.str);
YYABORT; MYSQL_YYABORT;
} }
sp_variable_t *spvar= spc->push_variable(&$3, sp_variable_t *spvar= spc->push_variable(&$3,
(enum enum_field_types)$4, (enum enum_field_types)$4,
...@@ -1810,7 +1877,7 @@ sp_pdparam: ...@@ -1810,7 +1877,7 @@ sp_pdparam:
(enum enum_field_types) $4, (enum enum_field_types) $4,
&spvar->field_def)) &spvar->field_def))
{ {
YYABORT; MYSQL_YYABORT;
} }
spvar->field_def.field_name= spvar->name.str; spvar->field_def.field_name= spvar->name.str;
spvar->field_def.pack_flag |= FIELDFLAG_MAYBE_NULL; spvar->field_def.pack_flag |= FIELDFLAG_MAYBE_NULL;
...@@ -1849,13 +1916,13 @@ sp_decls: ...@@ -1849,13 +1916,13 @@ sp_decls:
{ /* Variable or condition following cursor or handler */ { /* Variable or condition following cursor or handler */
my_message(ER_SP_VARCOND_AFTER_CURSHNDLR, my_message(ER_SP_VARCOND_AFTER_CURSHNDLR,
ER(ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0)); ER(ER_SP_VARCOND_AFTER_CURSHNDLR), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
if ($2.curs && $1.hndlrs) if ($2.curs && $1.hndlrs)
{ /* Cursor following handler */ { /* Cursor following handler */
my_message(ER_SP_CURSOR_AFTER_HANDLER, my_message(ER_SP_CURSOR_AFTER_HANDLER,
ER(ER_SP_CURSOR_AFTER_HANDLER), MYF(0)); ER(ER_SP_CURSOR_AFTER_HANDLER), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
$$.vars= $1.vars + $2.vars; $$.vars= $1.vars + $2.vars;
$$.conds= $1.conds + $2.conds; $$.conds= $1.conds + $2.conds;
...@@ -1893,7 +1960,7 @@ sp_decl: ...@@ -1893,7 +1960,7 @@ sp_decl:
sp_variable_t *spvar= pctx->find_variable(var_idx); sp_variable_t *spvar= pctx->find_variable(var_idx);
if (!spvar) if (!spvar)
YYABORT; MYSQL_YYABORT;
spvar->type= var_type; spvar->type= var_type;
spvar->dflt= dflt_value_item; spvar->dflt= dflt_value_item;
...@@ -1901,7 +1968,7 @@ sp_decl: ...@@ -1901,7 +1968,7 @@ sp_decl:
if (lex->sphead->fill_field_definition(YYTHD, lex, var_type, if (lex->sphead->fill_field_definition(YYTHD, lex, var_type,
&spvar->field_def)) &spvar->field_def))
{ {
YYABORT; MYSQL_YYABORT;
} }
spvar->field_def.field_name= spvar->name.str; spvar->field_def.field_name= spvar->name.str;
...@@ -1929,7 +1996,7 @@ sp_decl: ...@@ -1929,7 +1996,7 @@ sp_decl:
if (spc->find_cond(&$2, TRUE)) if (spc->find_cond(&$2, TRUE))
{ {
my_error(ER_SP_DUP_COND, MYF(0), $2.str); my_error(ER_SP_DUP_COND, MYF(0), $2.str);
YYABORT; MYSQL_YYABORT;
} }
YYTHD->lex->spcont->push_cond(&$2, $5); YYTHD->lex->spcont->push_cond(&$2, $5);
$$.vars= $$.hndlrs= $$.curs= 0; $$.vars= $$.hndlrs= $$.curs= 0;
...@@ -1987,7 +2054,7 @@ sp_decl: ...@@ -1987,7 +2054,7 @@ sp_decl:
{ {
my_error(ER_SP_DUP_CURS, MYF(0), $2.str); my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
delete $5; delete $5;
YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_cpush(sp->instructions(), ctx, $5, i= new sp_instr_cpush(sp->instructions(), ctx, $5,
ctx->current_cursor_count()); ctx->current_cursor_count());
...@@ -2015,13 +2082,13 @@ sp_cursor_stmt: ...@@ -2015,13 +2082,13 @@ sp_cursor_stmt:
{ {
my_message(ER_SP_BAD_CURSOR_QUERY, ER(ER_SP_BAD_CURSOR_QUERY), my_message(ER_SP_BAD_CURSOR_QUERY, ER(ER_SP_BAD_CURSOR_QUERY),
MYF(0)); MYF(0));
YYABORT; MYSQL_YYABORT;
} }
if (lex->result) if (lex->result)
{ {
my_message(ER_SP_BAD_CURSOR_SELECT, ER(ER_SP_BAD_CURSOR_SELECT), my_message(ER_SP_BAD_CURSOR_SELECT, ER(ER_SP_BAD_CURSOR_SELECT),
MYF(0)); MYF(0));
YYABORT; MYSQL_YYABORT;
} }
lex->sp_lex_in_use= TRUE; lex->sp_lex_in_use= TRUE;
$$= lex; $$= lex;
...@@ -2045,7 +2112,7 @@ sp_hcond_list: ...@@ -2045,7 +2112,7 @@ sp_hcond_list:
if (ctx->find_handler($1)) if (ctx->find_handler($1))
{ {
my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0)); my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2066,7 +2133,7 @@ sp_hcond_list: ...@@ -2066,7 +2133,7 @@ sp_hcond_list:
if (ctx->find_handler($3)) if (ctx->find_handler($3))
{ {
my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0)); my_message(ER_SP_DUP_HANDLER, ER(ER_SP_DUP_HANDLER), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2092,7 +2159,7 @@ sp_cond: ...@@ -2092,7 +2159,7 @@ sp_cond:
if (!sp_cond_check(&$3)) if (!sp_cond_check(&$3))
{ {
my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str); my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
YYABORT; MYSQL_YYABORT;
} }
$$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t)); $$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
$$->type= sp_cond_type_t::state; $$->type= sp_cond_type_t::state;
...@@ -2117,7 +2184,7 @@ sp_hcond: ...@@ -2117,7 +2184,7 @@ sp_hcond:
if ($$ == NULL) if ($$ == NULL)
{ {
my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str); my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
} }
| SQLWARNING_SYM /* SQLSTATEs 01??? */ | SQLWARNING_SYM /* SQLSTATEs 01??? */
...@@ -2148,7 +2215,7 @@ sp_decl_idents: ...@@ -2148,7 +2215,7 @@ sp_decl_idents:
if (spc->find_variable(&$1, TRUE)) if (spc->find_variable(&$1, TRUE))
{ {
my_error(ER_SP_DUP_VAR, MYF(0), $1.str); my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
spc->push_variable(&$1, (enum_field_types)0, sp_param_in); spc->push_variable(&$1, (enum_field_types)0, sp_param_in);
$$= 1; $$= 1;
...@@ -2163,7 +2230,7 @@ sp_decl_idents: ...@@ -2163,7 +2230,7 @@ sp_decl_idents:
if (spc->find_variable(&$3, TRUE)) if (spc->find_variable(&$3, TRUE))
{ {
my_error(ER_SP_DUP_VAR, MYF(0), $3.str); my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
YYABORT; MYSQL_YYABORT;
} }
spc->push_variable(&$3, (enum_field_types)0, sp_param_in); spc->push_variable(&$3, (enum_field_types)0, sp_param_in);
$$= $1 + 1; $$= $1 + 1;
...@@ -2191,7 +2258,7 @@ sp_proc_stmt: ...@@ -2191,7 +2258,7 @@ sp_proc_stmt:
if (lex->sql_command == SQLCOM_CHANGE_DB) if (lex->sql_command == SQLCOM_CHANGE_DB)
{ /* "USE db" doesn't work in a procedure */ { /* "USE db" doesn't work in a procedure */
my_error(ER_SP_BADSTATEMENT, MYF(0), "USE"); my_error(ER_SP_BADSTATEMENT, MYF(0), "USE");
YYABORT; MYSQL_YYABORT;
} }
/* /*
Don't add an instruction for SET statements, since all Don't add an instruction for SET statements, since all
...@@ -2231,7 +2298,7 @@ sp_proc_stmt: ...@@ -2231,7 +2298,7 @@ sp_proc_stmt:
if (sp->m_type != TYPE_ENUM_FUNCTION) if (sp->m_type != TYPE_ENUM_FUNCTION)
{ {
my_message(ER_SP_BADRETURN, ER(ER_SP_BADRETURN), MYF(0)); my_message(ER_SP_BADRETURN, ER(ER_SP_BADRETURN), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2272,7 +2339,7 @@ sp_proc_stmt: ...@@ -2272,7 +2339,7 @@ sp_proc_stmt:
if (! lab) if (! lab)
{ {
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str); my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2301,7 +2368,7 @@ sp_proc_stmt: ...@@ -2301,7 +2368,7 @@ sp_proc_stmt:
if (! lab || lab->type != SP_LAB_ITER) if (! lab || lab->type != SP_LAB_ITER)
{ {
my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str); my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2329,7 +2396,7 @@ sp_proc_stmt: ...@@ -2329,7 +2396,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str); my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset); i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
sp->add_instr(i); sp->add_instr(i);
...@@ -2344,7 +2411,7 @@ sp_proc_stmt: ...@@ -2344,7 +2411,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$3, &offset)) if (! lex->spcont->find_cursor(&$3, &offset))
{ {
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str); my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $3.str);
YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset); i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
sp->add_instr(i); sp->add_instr(i);
...@@ -2361,7 +2428,7 @@ sp_proc_stmt: ...@@ -2361,7 +2428,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str); my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
YYABORT; MYSQL_YYABORT;
} }
i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset); i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
sp->add_instr(i); sp->add_instr(i);
...@@ -2385,7 +2452,7 @@ sp_fetch_list: ...@@ -2385,7 +2452,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_variable(&$1))) if (!spc || !(spv = spc->find_variable(&$1)))
{ {
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str); my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2406,7 +2473,7 @@ sp_fetch_list: ...@@ -2406,7 +2473,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_variable(&$3))) if (!spc || !(spv = spc->find_variable(&$3)))
{ {
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str); my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2475,7 +2542,7 @@ simple_case_stmt: ...@@ -2475,7 +2542,7 @@ simple_case_stmt:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (case_stmt_action_expr(lex, $3)) if (case_stmt_action_expr(lex, $3))
YYABORT; MYSQL_YYABORT;
lex->sphead->restore_lex(YYTHD); /* For expr $3 */ lex->sphead->restore_lex(YYTHD); /* For expr $3 */
} }
...@@ -2578,7 +2645,7 @@ sp_labeled_control: ...@@ -2578,7 +2645,7 @@ sp_labeled_control:
if (lab) if (lab)
{ {
my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str); my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -2599,7 +2666,7 @@ sp_labeled_control: ...@@ -2599,7 +2666,7 @@ sp_labeled_control:
my_strcasecmp(system_charset_info, $5.str, lab->name) != 0) my_strcasecmp(system_charset_info, $5.str, lab->name) != 0)
{ {
my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str); my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
YYABORT; MYSQL_YYABORT;
} }
} }
lex->sphead->backpatch(lex->spcont->pop_label()); lex->sphead->backpatch(lex->spcont->pop_label());
...@@ -2716,11 +2783,11 @@ create2: ...@@ -2716,11 +2783,11 @@ create2:
LEX *lex=Lex; LEX *lex=Lex;
THD *thd= lex->thd; THD *thd= lex->thd;
if (!(lex->name= (char *)$2)) if (!(lex->name= (char *)$2))
YYABORT; MYSQL_YYABORT;
if ($2->db.str == NULL && if ($2->db.str == NULL &&
thd->copy_db_to(&($2->db.str), &($2->db.length))) thd->copy_db_to(&($2->db.str), &($2->db.length)))
{ {
YYABORT; MYSQL_YYABORT;
} }
} }
| '(' LIKE table_ident ')' | '(' LIKE table_ident ')'
...@@ -2728,11 +2795,11 @@ create2: ...@@ -2728,11 +2795,11 @@ create2:
LEX *lex=Lex; LEX *lex=Lex;
THD *thd= lex->thd; THD *thd= lex->thd;
if (!(lex->name= (char *)$3)) if (!(lex->name= (char *)$3))
YYABORT; MYSQL_YYABORT;
if ($3->db.str == NULL && if ($3->db.str == NULL &&
thd->copy_db_to(&($3->db.str), &($3->db.length))) thd->copy_db_to(&($3->db.str), &($3->db.length)))
{ {
YYABORT; MYSQL_YYABORT;
} }
} }
; ;
...@@ -2844,8 +2911,8 @@ create_table_option: ...@@ -2844,8 +2911,8 @@ 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:
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS; Lex->create_info.used_fields|= HA_CREATE_USED_PACK_KEYS;
} }
...@@ -2861,17 +2928,17 @@ create_table_option: ...@@ -2861,17 +2928,17 @@ create_table_option:
| RAID_TYPE opt_equal raid_types | RAID_TYPE opt_equal raid_types
{ {
my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_TYPE", "PARTITION"); my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_TYPE", "PARTITION");
YYABORT; MYSQL_YYABORT;
} }
| RAID_CHUNKS opt_equal ulong_num | RAID_CHUNKS opt_equal ulong_num
{ {
my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKS", "PARTITION"); my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKS", "PARTITION");
YYABORT; MYSQL_YYABORT;
} }
| RAID_CHUNKSIZE opt_equal ulong_num | RAID_CHUNKSIZE opt_equal ulong_num
{ {
my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKSIZE", "PARTITION"); my_error(ER_WARN_DEPRECATED_SYNTAX, MYF(0), "RAID_CHUNKSIZE", "PARTITION");
YYABORT; MYSQL_YYABORT;
} }
| UNION_SYM opt_equal '(' table_list ')' | UNION_SYM opt_equal '(' table_list ')'
{ {
...@@ -2907,7 +2974,7 @@ default_charset: ...@@ -2907,7 +2974,7 @@ default_charset:
my_error(ER_CONFLICTING_DECLARATIONS, MYF(0), my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
"CHARACTER SET ", cinfo->default_table_charset->csname, "CHARACTER SET ", cinfo->default_table_charset->csname,
"CHARACTER SET ", $4->csname); "CHARACTER SET ", $4->csname);
YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.default_table_charset= $4; Lex->create_info.default_table_charset= $4;
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
...@@ -2923,7 +2990,7 @@ default_collation: ...@@ -2923,7 +2990,7 @@ default_collation:
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$4->name, cinfo->default_table_charset->csname); $4->name, cinfo->default_table_charset->csname);
YYABORT; MYSQL_YYABORT;
} }
Lex->create_info.default_table_charset= $4; Lex->create_info.default_table_charset= $4;
Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
...@@ -2935,7 +3002,7 @@ storage_engines: ...@@ -2935,7 +3002,7 @@ storage_engines:
$$ = ha_resolve_by_name($1.str,$1.length); $$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) { if ($$ == DB_TYPE_UNKNOWN) {
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str); my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
}; };
...@@ -3070,7 +3137,7 @@ field_spec: ...@@ -3070,7 +3137,7 @@ field_spec:
&lex->comment, &lex->comment,
lex->change,&lex->interval_list,lex->charset, lex->change,&lex->interval_list,lex->charset,
lex->uint_geom_type)) lex->uint_geom_type))
YYABORT; MYSQL_YYABORT;
}; };
type: type:
...@@ -3139,7 +3206,7 @@ type: ...@@ -3139,7 +3206,7 @@ type:
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; MYSQL_YYABORT;
#endif #endif
} }
| MEDIUMBLOB { Lex->charset=&my_charset_bin; | MEDIUMBLOB { Lex->charset=&my_charset_bin;
...@@ -3300,7 +3367,7 @@ attribute: ...@@ -3300,7 +3367,7 @@ attribute:
{ {
my_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);
YYABORT; MYSQL_YYABORT;
} }
else else
{ {
...@@ -3325,7 +3392,7 @@ charset_name: ...@@ -3325,7 +3392,7 @@ 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))))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str); my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
} }
| BINARY { $$= &my_charset_bin; } | BINARY { $$= &my_charset_bin; }
...@@ -3347,7 +3414,7 @@ old_or_new_charset_name: ...@@ -3347,7 +3414,7 @@ old_or_new_charset_name:
!($$=get_old_charset_by_name($1.str))) !($$=get_old_charset_by_name($1.str)))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str); my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
} }
| BINARY { $$= &my_charset_bin; } | BINARY { $$= &my_charset_bin; }
...@@ -3363,7 +3430,7 @@ collation_name: ...@@ -3363,7 +3430,7 @@ collation_name:
if (!($$=get_charset_by_name($1.str,MYF(0)))) if (!($$=get_charset_by_name($1.str,MYF(0))))
{ {
my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str); my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
}; };
...@@ -3390,7 +3457,7 @@ opt_binary: ...@@ -3390,7 +3457,7 @@ opt_binary:
MY_CS_PRIMARY,MYF(0)))) MY_CS_PRIMARY,MYF(0))))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2"); my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
YYABORT; MYSQL_YYABORT;
} }
} }
| charset charset_name opt_bin_mod { Lex->charset=$2; } | charset charset_name opt_bin_mod { Lex->charset=$2; }
...@@ -3409,7 +3476,7 @@ opt_bin_charset: ...@@ -3409,7 +3476,7 @@ opt_bin_charset:
MY_CS_PRIMARY,MYF(0)))) MY_CS_PRIMARY,MYF(0))))
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2"); my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
YYABORT; MYSQL_YYABORT;
} }
} }
| charset charset_name { Lex->charset=$2; } ; | charset charset_name { Lex->charset=$2; } ;
...@@ -3472,7 +3539,7 @@ key_type: ...@@ -3472,7 +3539,7 @@ key_type:
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; MYSQL_YYABORT;
#endif #endif
}; };
...@@ -3505,7 +3572,7 @@ opt_unique_or_fulltext: ...@@ -3505,7 +3572,7 @@ opt_unique_or_fulltext:
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; MYSQL_YYABORT;
#endif #endif
} }
; ;
...@@ -3565,7 +3632,7 @@ alter: ...@@ -3565,7 +3632,7 @@ alter:
lex->duplicates= DUP_ERROR; lex->duplicates= DUP_ERROR;
if (!lex->select_lex.add_table_to_list(thd, $4, NULL, if (!lex->select_lex.add_table_to_list(thd, $4, NULL,
TL_OPTION_UPDATING)) TL_OPTION_UPDATING))
YYABORT; MYSQL_YYABORT;
lex->col_list.empty(); lex->col_list.empty();
lex->select_lex.init_order(); lex->select_lex.init_order();
lex->select_lex.db= lex->select_lex.db=
...@@ -3591,7 +3658,7 @@ alter: ...@@ -3591,7 +3658,7 @@ alter:
lex->sql_command=SQLCOM_ALTER_DB; lex->sql_command=SQLCOM_ALTER_DB;
lex->name= $3; lex->name= $3;
if (lex->name == NULL && thd->copy_db_to(&lex->name, NULL)) if (lex->name == NULL && thd->copy_db_to(&lex->name, NULL))
YYABORT; MYSQL_YYABORT;
} }
| ALTER PROCEDURE sp_name | ALTER PROCEDURE sp_name
{ {
...@@ -3600,7 +3667,7 @@ alter: ...@@ -3600,7 +3667,7 @@ alter:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"); my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
YYABORT; MYSQL_YYABORT;
} }
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
} }
...@@ -3618,7 +3685,7 @@ alter: ...@@ -3618,7 +3685,7 @@ alter:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"); my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
YYABORT; MYSQL_YYABORT;
} }
bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics));
} }
...@@ -3697,7 +3764,7 @@ alter_list_item: ...@@ -3697,7 +3764,7 @@ alter_list_item:
&lex->comment, &lex->comment,
$3.str, &lex->interval_list, lex->charset, $3.str, &lex->interval_list, lex->charset,
lex->uint_geom_type)) lex->uint_geom_type))
YYABORT; MYSQL_YYABORT;
} }
opt_place opt_place
| DROP opt_column field_ident opt_restrict | DROP opt_column field_ident opt_restrict
...@@ -3758,13 +3825,13 @@ alter_list_item: ...@@ -3758,13 +3825,13 @@ alter_list_item:
if (lex->select_lex.db == NULL && if (lex->select_lex.db == NULL &&
thd->copy_db_to(&lex->select_lex.db, NULL)) thd->copy_db_to(&lex->select_lex.db, NULL))
{ {
YYABORT; MYSQL_YYABORT;
} }
if (check_table_name($3->table.str,$3->table.length) || if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name($3->db.str)) $3->db.str && check_db_name($3->db.str))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str); my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
YYABORT; MYSQL_YYABORT;
} }
lex->name= $3->table.str; lex->name= $3->table.str;
lex->alter_info.flags|= ALTER_RENAME; lex->alter_info.flags|= ALTER_RENAME;
...@@ -3781,7 +3848,7 @@ alter_list_item: ...@@ -3781,7 +3848,7 @@ alter_list_item:
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$5->name, $4->csname); $5->name, $4->csname);
YYABORT; MYSQL_YYABORT;
} }
LEX *lex= Lex; LEX *lex= Lex;
lex->create_info.table_charset= lex->create_info.table_charset=
...@@ -3919,7 +3986,7 @@ slave_until: ...@@ -3919,7 +3986,7 @@ slave_until:
{ {
my_message(ER_BAD_SLAVE_UNTIL_COND, my_message(ER_BAD_SLAVE_UNTIL_COND,
ER(ER_BAD_SLAVE_UNTIL_COND), MYF(0)); ER(ER_BAD_SLAVE_UNTIL_COND), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
} }
...@@ -4011,7 +4078,7 @@ check: ...@@ -4011,7 +4078,7 @@ check:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK"); my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command = SQLCOM_CHECK; lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init(); lex->check_opt.init();
...@@ -4071,12 +4138,12 @@ rename_list: ...@@ -4071,12 +4138,12 @@ rename_list:
user TO_SYM user user TO_SYM user
{ {
if (Lex->users_list.push_back($1) || Lex->users_list.push_back($3)) if (Lex->users_list.push_back($1) || Lex->users_list.push_back($3))
YYABORT; MYSQL_YYABORT;
} }
| rename_list ',' user TO_SYM user | rename_list ',' user TO_SYM user
{ {
if (Lex->users_list.push_back($3) || Lex->users_list.push_back($5)) if (Lex->users_list.push_back($3) || Lex->users_list.push_back($5))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -4093,7 +4160,7 @@ table_to_table: ...@@ -4093,7 +4160,7 @@ table_to_table:
TL_IGNORE) || TL_IGNORE) ||
!sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING, !sl->add_table_to_list(lex->thd, $3,NULL,TL_OPTION_UPDATING,
TL_IGNORE)) TL_IGNORE))
YYABORT; MYSQL_YYABORT;
}; };
keycache: keycache:
...@@ -4118,7 +4185,7 @@ assign_to_keycache: ...@@ -4118,7 +4185,7 @@ assign_to_keycache:
TL_READ, TL_READ,
sel->get_use_index(), sel->get_use_index(),
(List<String> *)0)) (List<String> *)0))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -4150,7 +4217,7 @@ preload_keys: ...@@ -4150,7 +4217,7 @@ preload_keys:
TL_READ, TL_READ,
sel->get_use_index(), sel->get_use_index(),
(List<String> *)0)) (List<String> *)0))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -4205,16 +4272,16 @@ select_paren: ...@@ -4205,16 +4272,16 @@ select_paren:
SELECT_LEX * sel= lex->current_select; SELECT_LEX * sel= lex->current_select;
if (sel->set_braces(1)) if (sel->set_braces(1))
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
if (sel->linkage == UNION_TYPE && if (sel->linkage == UNION_TYPE &&
!sel->master_unit()->first_select()->braces && !sel->master_unit()->first_select()->braces &&
sel->master_unit()->first_select()->linkage == sel->master_unit()->first_select()->linkage ==
UNION_TYPE) UNION_TYPE)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
/* select in braces, can't contain global parameters */ /* select in braces, can't contain global parameters */
if (sel->master_unit()->fake_select_lex) if (sel->master_unit()->fake_select_lex)
...@@ -4230,14 +4297,14 @@ select_init2: ...@@ -4230,14 +4297,14 @@ 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))
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
if (sel->linkage == UNION_TYPE && if (sel->linkage == UNION_TYPE &&
sel->master_unit()->first_select()->braces) sel->master_unit()->first_select()->braces)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
} }
union_clause union_clause
...@@ -4286,7 +4353,7 @@ select_options: ...@@ -4286,7 +4353,7 @@ select_options:
if (test_all_bits(Select->options, SELECT_ALL | SELECT_DISTINCT)) if (test_all_bits(Select->options, SELECT_ALL | SELECT_DISTINCT))
{ {
my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT"); my_error(ER_WRONG_USAGE, MYF(0), "ALL", "DISTINCT");
YYABORT; MYSQL_YYABORT;
} }
} }
; ;
...@@ -4300,7 +4367,7 @@ select_option: ...@@ -4300,7 +4367,7 @@ select_option:
| HIGH_PRIORITY | HIGH_PRIORITY
{ {
if (check_simple_select()) if (check_simple_select())
YYABORT; MYSQL_YYABORT;
Lex->lock_option= TL_READ_HIGH_PRIORITY; Lex->lock_option= TL_READ_HIGH_PRIORITY;
} }
| DISTINCT { Select->options|= SELECT_DISTINCT; } | DISTINCT { Select->options|= SELECT_DISTINCT; }
...@@ -4309,13 +4376,13 @@ select_option: ...@@ -4309,13 +4376,13 @@ select_option:
| SQL_BUFFER_RESULT | SQL_BUFFER_RESULT
{ {
if (check_simple_select()) if (check_simple_select())
YYABORT; MYSQL_YYABORT;
Select->options|= OPTION_BUFFER_RESULT; Select->options|= OPTION_BUFFER_RESULT;
} }
| SQL_CALC_FOUND_ROWS | SQL_CALC_FOUND_ROWS
{ {
if (check_simple_select()) if (check_simple_select())
YYABORT; MYSQL_YYABORT;
Select->options|= OPTION_FOUND_ROWS; Select->options|= OPTION_FOUND_ROWS;
} }
| SQL_NO_CACHE_SYM | SQL_NO_CACHE_SYM
...@@ -4364,7 +4431,7 @@ select_item_list: ...@@ -4364,7 +4431,7 @@ select_item_list:
new Item_field(&thd->lex->current_select-> new Item_field(&thd->lex->current_select->
context, context,
NULL, NULL, "*"))) NULL, NULL, "*")))
YYABORT; MYSQL_YYABORT;
(thd->lex->current_select->with_wild)++; (thd->lex->current_select->with_wild)++;
}; };
...@@ -4373,7 +4440,7 @@ select_item: ...@@ -4373,7 +4440,7 @@ select_item:
remember_name select_item2 remember_end select_alias remember_name select_item2 remember_end select_alias
{ {
if (add_item_to_list(YYTHD, $2)) if (add_item_to_list(YYTHD, $2))
YYABORT; MYSQL_YYABORT;
if ($4.str) if ($4.str)
{ {
$2->is_autogenerated_name= FALSE; $2->is_autogenerated_name= FALSE;
...@@ -4653,7 +4720,7 @@ simple_expr: ...@@ -4653,7 +4720,7 @@ simple_expr:
lex->dec ? atoi(lex->dec) : 0, lex->dec ? atoi(lex->dec) : 0,
lex->charset); lex->charset);
if (!$$) if (!$$)
YYABORT; MYSQL_YYABORT;
} }
| CASE_SYM opt_expr when_list opt_else END | CASE_SYM opt_expr when_list opt_else END
{ $$= new Item_func_case(* $3, $2, $4 ); } { $$= new Item_func_case(* $3, $2, $4 ); }
...@@ -4664,7 +4731,7 @@ simple_expr: ...@@ -4664,7 +4731,7 @@ simple_expr:
Lex->dec ? atoi(Lex->dec) : 0, Lex->dec ? atoi(Lex->dec) : 0,
Lex->charset); Lex->charset);
if (!$$) if (!$$)
YYABORT; MYSQL_YYABORT;
} }
| CONVERT_SYM '(' expr USING charset_name ')' | CONVERT_SYM '(' expr USING charset_name ')'
{ $$= new Item_func_conv_charset($3,$5); } { $$= new Item_func_conv_charset($3,$5); }
...@@ -4675,7 +4742,7 @@ simple_expr: ...@@ -4675,7 +4742,7 @@ simple_expr:
Item_splocal *il= static_cast<Item_splocal *>($3); Item_splocal *il= static_cast<Item_splocal *>($3);
my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str); my_error(ER_WRONG_COLUMN_NAME, MYF(0), il->my_name()->str);
YYABORT; MYSQL_YYABORT;
} }
$$= new Item_default_value(Lex->current_context(), $3); $$= new Item_default_value(Lex->current_context(), $3);
} }
...@@ -4688,7 +4755,7 @@ simple_expr: ...@@ -4688,7 +4755,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; MYSQL_YYABORT;
} }
$$= ((Item*(*)(void))($1.symbol->create_func))(); $$= ((Item*(*)(void))($1.symbol->create_func))();
} }
...@@ -4699,7 +4766,7 @@ simple_expr: ...@@ -4699,7 +4766,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; MYSQL_YYABORT;
} }
$$= ((Item*(*)(Item*))($1.symbol->create_func))($3); $$= ((Item*(*)(Item*))($1.symbol->create_func))($3);
} }
...@@ -4710,7 +4777,7 @@ simple_expr: ...@@ -4710,7 +4777,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; MYSQL_YYABORT;
} }
$$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5); $$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5);
} }
...@@ -4721,7 +4788,7 @@ simple_expr: ...@@ -4721,7 +4788,7 @@ simple_expr:
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; MYSQL_YYABORT;
} }
$$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7); $$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7);
} }
...@@ -4752,7 +4819,7 @@ simple_expr: ...@@ -4752,7 +4819,7 @@ simple_expr:
| CONVERT_TZ_SYM '(' expr ',' expr ',' expr ')' | CONVERT_TZ_SYM '(' expr ',' expr ',' expr ')'
{ {
if (Lex->add_time_zone_tables_to_query_tables(YYTHD)) if (Lex->add_time_zone_tables_to_query_tables(YYTHD))
YYABORT; MYSQL_YYABORT;
$$= new Item_func_convert_tz($3, $5, $7); $$= new Item_func_convert_tz($3, $5, $7);
} }
| CURDATE optional_braces | CURDATE optional_braces
...@@ -4827,7 +4894,7 @@ simple_expr: ...@@ -4827,7 +4894,7 @@ simple_expr:
#else #else
my_error(ER_FEATURE_DISABLED, MYF(0), my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; MYSQL_YYABORT;
#endif #endif
} }
| GET_FORMAT '(' date_time_type ',' expr ')' | GET_FORMAT '(' date_time_type ',' expr ')'
...@@ -4845,8 +4912,8 @@ simple_expr: ...@@ -4845,8 +4912,8 @@ simple_expr:
{ {
if ($1->type() != Item::ROW_ITEM) if ($1->type() != Item::ROW_ITEM)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
$$= new Item_func_interval((Item_row *)$1); $$= new Item_func_interval((Item_row *)$1);
} }
...@@ -5006,8 +5073,8 @@ simple_expr: ...@@ -5006,8 +5073,8 @@ simple_expr:
{ {
if (lex->current_select->inc_in_sum_expr()) if (lex->current_select->inc_in_sum_expr())
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
} }
lex->current_select->udf_list.push_front(udf); lex->current_select->udf_list.push_front(udf);
...@@ -5090,7 +5157,7 @@ simple_expr: ...@@ -5090,7 +5157,7 @@ simple_expr:
} }
break; break;
default: default:
YYABORT; MYSQL_YYABORT;
} }
} }
else else
...@@ -5099,7 +5166,7 @@ simple_expr: ...@@ -5099,7 +5166,7 @@ simple_expr:
THD *thd= lex->thd; THD *thd= lex->thd;
LEX_STRING db; LEX_STRING db;
if (thd->copy_db_to(&db.str, &db.length)) if (thd->copy_db_to(&db.str, &db.length))
YYABORT; MYSQL_YYABORT;
sp_name *name= new sp_name(db, $1); sp_name *name= new sp_name(db, $1);
if (name) if (name)
name->init_qname(thd); name->init_qname(thd);
...@@ -5260,8 +5327,8 @@ udf_expr: ...@@ -5260,8 +5327,8 @@ udf_expr:
Disallow using AS to specify explicit names for the arguments Disallow using AS to specify explicit names for the arguments
of stored routine calls of stored routine calls
*/ */
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
$2->is_autogenerated_name= FALSE; $2->is_autogenerated_name= FALSE;
...@@ -5340,7 +5407,7 @@ variable: ...@@ -5340,7 +5407,7 @@ variable:
if (! Lex->parsing_options.allows_variable) if (! Lex->parsing_options.allows_variable)
{ {
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0)); my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
YYABORT; MYSQL_YYABORT;
} }
} }
variable_aux variable_aux
...@@ -5366,11 +5433,11 @@ variable_aux: ...@@ -5366,11 +5433,11 @@ variable_aux:
{ {
if ($3.str && $4.str && check_reserved_words(&$3)) if ($3.str && $4.str && check_reserved_words(&$3))
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
if (!($$= get_system_var(YYTHD, $2, $3, $4))) if (!($$= get_system_var(YYTHD, $2, $3, $4)))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -5404,8 +5471,8 @@ in_sum_expr: ...@@ -5404,8 +5471,8 @@ 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())
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
} }
expr expr
...@@ -5485,12 +5552,12 @@ table_ref: ...@@ -5485,12 +5552,12 @@ table_ref:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(lex->thd))) if (!($$= lex->current_select->nest_last_join(lex->thd)))
YYABORT; MYSQL_YYABORT;
} }
; ;
join_table_list: join_table_list:
derived_table_list { YYABORT_UNLESS($$=$1); } derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); }
; ;
/* Warning - may return NULL in case of incomplete SELECT */ /* Warning - may return NULL in case of incomplete SELECT */
...@@ -5498,7 +5565,7 @@ derived_table_list: ...@@ -5498,7 +5565,7 @@ derived_table_list:
table_ref { $$=$1; } table_ref { $$=$1; }
| derived_table_list ',' table_ref | derived_table_list ',' table_ref
{ {
YYABORT_UNLESS($1 && ($$=$3)); MYSQL_YYABORT_UNLESS($1 && ($$=$3));
} }
; ;
...@@ -5517,16 +5584,16 @@ join_table: ...@@ -5517,16 +5584,16 @@ join_table:
left-associative joins. left-associative joins.
*/ */
table_ref %prec TABLE_REF_PRIORITY normal_join table_ref table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
{ YYABORT_UNLESS($1 && ($$=$3)); } { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); }
| table_ref STRAIGHT_JOIN table_factor | table_ref STRAIGHT_JOIN table_factor
{ YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; } { MYSQL_YYABORT_UNLESS($1 && ($$=$3)); $3->straight=1; }
| table_ref normal_join table_ref | table_ref normal_join table_ref
ON ON
{ {
YYABORT_UNLESS($1 && $3); MYSQL_YYABORT_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */ /* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3)) if (push_new_name_resolution_context(YYTHD, $1, $3))
YYABORT; MYSQL_YYABORT;
Select->parsing_place= IN_ON; Select->parsing_place= IN_ON;
} }
expr expr
...@@ -5538,10 +5605,10 @@ join_table: ...@@ -5538,10 +5605,10 @@ join_table:
| table_ref STRAIGHT_JOIN table_factor | table_ref STRAIGHT_JOIN table_factor
ON ON
{ {
YYABORT_UNLESS($1 && $3); MYSQL_YYABORT_UNLESS($1 && $3);
/* Change the current name resolution context to a local context. */ /* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $3)) if (push_new_name_resolution_context(YYTHD, $1, $3))
YYABORT; MYSQL_YYABORT;
Select->parsing_place= IN_ON; Select->parsing_place= IN_ON;
} }
expr expr
...@@ -5554,13 +5621,13 @@ join_table: ...@@ -5554,13 +5621,13 @@ join_table:
| table_ref normal_join table_ref | table_ref normal_join table_ref
USING USING
{ {
YYABORT_UNLESS($1 && $3); MYSQL_YYABORT_UNLESS($1 && $3);
} }
'(' using_list ')' '(' using_list ')'
{ add_join_natural($1,$3,$7,Select); $$=$3; } { add_join_natural($1,$3,$7,Select); $$=$3; }
| table_ref NATURAL JOIN_SYM table_factor | table_ref NATURAL JOIN_SYM table_factor
{ {
YYABORT_UNLESS($1 && ($$=$4)); MYSQL_YYABORT_UNLESS($1 && ($$=$4));
add_join_natural($1,$4,NULL,Select); add_join_natural($1,$4,NULL,Select);
} }
...@@ -5568,10 +5635,10 @@ join_table: ...@@ -5568,10 +5635,10 @@ join_table:
| table_ref LEFT opt_outer JOIN_SYM table_ref | table_ref LEFT opt_outer JOIN_SYM table_ref
ON ON
{ {
YYABORT_UNLESS($1 && $5); MYSQL_YYABORT_UNLESS($1 && $5);
/* Change the current name resolution context to a local context. */ /* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $5)) if (push_new_name_resolution_context(YYTHD, $1, $5))
YYABORT; MYSQL_YYABORT;
Select->parsing_place= IN_ON; Select->parsing_place= IN_ON;
} }
expr expr
...@@ -5584,7 +5651,7 @@ join_table: ...@@ -5584,7 +5651,7 @@ join_table:
} }
| table_ref LEFT opt_outer JOIN_SYM table_factor | table_ref LEFT opt_outer JOIN_SYM table_factor
{ {
YYABORT_UNLESS($1 && $5); MYSQL_YYABORT_UNLESS($1 && $5);
} }
USING '(' using_list ')' USING '(' using_list ')'
{ {
...@@ -5594,7 +5661,7 @@ join_table: ...@@ -5594,7 +5661,7 @@ join_table:
} }
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor | table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
{ {
YYABORT_UNLESS($1 && $6); MYSQL_YYABORT_UNLESS($1 && $6);
add_join_natural($1,$6,NULL,Select); add_join_natural($1,$6,NULL,Select);
$6->outer_join|=JOIN_TYPE_LEFT; $6->outer_join|=JOIN_TYPE_LEFT;
$$=$6; $$=$6;
...@@ -5604,39 +5671,39 @@ join_table: ...@@ -5604,39 +5671,39 @@ join_table:
| table_ref RIGHT opt_outer JOIN_SYM table_ref | table_ref RIGHT opt_outer JOIN_SYM table_ref
ON ON
{ {
YYABORT_UNLESS($1 && $5); MYSQL_YYABORT_UNLESS($1 && $5);
/* Change the current name resolution context to a local context. */ /* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $1, $5)) if (push_new_name_resolution_context(YYTHD, $1, $5))
YYABORT; MYSQL_YYABORT;
Select->parsing_place= IN_ON; Select->parsing_place= IN_ON;
} }
expr expr
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join())) if (!($$= lex->current_select->convert_right_join()))
YYABORT; MYSQL_YYABORT;
add_join_on($$, $8); add_join_on($$, $8);
Lex->pop_context(); Lex->pop_context();
Select->parsing_place= NO_MATTER; Select->parsing_place= NO_MATTER;
} }
| table_ref RIGHT opt_outer JOIN_SYM table_factor | table_ref RIGHT opt_outer JOIN_SYM table_factor
{ {
YYABORT_UNLESS($1 && $5); MYSQL_YYABORT_UNLESS($1 && $5);
} }
USING '(' using_list ')' USING '(' using_list ')'
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join())) if (!($$= lex->current_select->convert_right_join()))
YYABORT; MYSQL_YYABORT;
add_join_natural($$,$5,$9,Select); add_join_natural($$,$5,$9,Select);
} }
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor | table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
{ {
YYABORT_UNLESS($1 && $6); MYSQL_YYABORT_UNLESS($1 && $6);
add_join_natural($6,$1,NULL,Select); add_join_natural($6,$1,NULL,Select);
LEX *lex= Lex; LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join())) if (!($$= lex->current_select->convert_right_join()))
YYABORT; MYSQL_YYABORT;
}; };
normal_join: normal_join:
...@@ -5661,7 +5728,7 @@ table_factor: ...@@ -5661,7 +5728,7 @@ table_factor:
lex->lock_option, lex->lock_option,
sel->get_use_index(), sel->get_use_index(),
sel->get_ignore_index()))) sel->get_ignore_index())))
YYABORT; MYSQL_YYABORT;
sel->add_joined_table($$); sel->add_joined_table($$);
} }
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref | '{' ident table_ref LEFT OUTER JOIN_SYM table_ref
...@@ -5669,19 +5736,19 @@ table_factor: ...@@ -5669,19 +5736,19 @@ table_factor:
{ {
/* Change the current name resolution context to a local context. */ /* Change the current name resolution context to a local context. */
if (push_new_name_resolution_context(YYTHD, $3, $7)) if (push_new_name_resolution_context(YYTHD, $3, $7))
YYABORT; MYSQL_YYABORT;
} }
expr '}' expr '}'
{ {
LEX *lex= Lex; LEX *lex= Lex;
YYABORT_UNLESS($3 && $7); MYSQL_YYABORT_UNLESS($3 && $7);
add_join_on($7,$10); add_join_on($7,$10);
Lex->pop_context(); Lex->pop_context();
$7->outer_join|=JOIN_TYPE_LEFT; $7->outer_join|=JOIN_TYPE_LEFT;
$$=$7; $$=$7;
if (!($$= lex->current_select->nest_last_join(lex->thd))) if (!($$= lex->current_select->nest_last_join(lex->thd)))
YYABORT; MYSQL_YYABORT;
} }
| select_derived_init get_select_lex select_derived2 | select_derived_init get_select_lex select_derived2
{ {
...@@ -5691,8 +5758,8 @@ table_factor: ...@@ -5691,8 +5758,8 @@ table_factor:
{ {
if (sel->set_braces(1)) if (sel->set_braces(1))
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
/* select in braces, can't contain global parameters */ /* select in braces, can't contain global parameters */
if (sel->master_unit()->fake_select_lex) if (sel->master_unit()->fake_select_lex)
...@@ -5700,7 +5767,7 @@ table_factor: ...@@ -5700,7 +5767,7 @@ table_factor:
sel->master_unit()->fake_select_lex; sel->master_unit()->fake_select_lex;
} }
if ($2->init_nested_join(lex->thd)) if ($2->init_nested_join(lex->thd))
YYABORT; MYSQL_YYABORT;
$$= 0; $$= 0;
/* incomplete derived tables return NULL, we must be /* incomplete derived tables return NULL, we must be
nested in select_derived rule to be here. */ nested in select_derived rule to be here. */
...@@ -5734,7 +5801,7 @@ table_factor: ...@@ -5734,7 +5801,7 @@ table_factor:
TL_READ,(List<String> *)0, TL_READ,(List<String> *)0,
(List<String> *)0))) (List<String> *)0)))
YYABORT; MYSQL_YYABORT;
sel->add_joined_table($$); sel->add_joined_table($$);
lex->pop_context(); lex->pop_context();
} }
...@@ -5742,8 +5809,8 @@ table_factor: ...@@ -5742,8 +5809,8 @@ table_factor:
if ($4 || $6) if ($4 || $6)
{ {
/* simple nested joins cannot have aliases or unions */ /* simple nested joins cannot have aliases or unions */
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
else else
$$= $3; $$= $3;
...@@ -5756,7 +5823,7 @@ select_derived: ...@@ -5756,7 +5823,7 @@ select_derived:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if ($1->init_nested_join(lex->thd)) if ($1->init_nested_join(lex->thd))
YYABORT; MYSQL_YYABORT;
} }
derived_table_list derived_table_list
{ {
...@@ -5765,11 +5832,11 @@ select_derived: ...@@ -5765,11 +5832,11 @@ select_derived:
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(lex->thd)) && $3)
YYABORT; MYSQL_YYABORT;
if (!$3 && $$) if (!$3 && $$)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
} }
; ;
...@@ -5781,12 +5848,12 @@ select_derived2: ...@@ -5781,12 +5848,12 @@ select_derived2:
if (lex->sql_command == (int)SQLCOM_HA_READ || if (lex->sql_command == (int)SQLCOM_HA_READ ||
lex->sql_command == (int)SQLCOM_KILL) lex->sql_command == (int)SQLCOM_KILL)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE || if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE ||
mysql_new_select(lex, 1)) mysql_new_select(lex, 1))
YYABORT; MYSQL_YYABORT;
mysql_init_select(lex); mysql_init_select(lex);
lex->current_select->linkage= DERIVED_TABLE_TYPE; lex->current_select->linkage= DERIVED_TABLE_TYPE;
lex->current_select->parsing_place= SELECT_LIST; lex->current_select->parsing_place= SELECT_LIST;
...@@ -5810,7 +5877,7 @@ select_derived_init: ...@@ -5810,7 +5877,7 @@ select_derived_init:
if (! lex->parsing_options.allows_derived) if (! lex->parsing_options.allows_derived)
{ {
my_error(ER_VIEW_SELECT_DERIVED, MYF(0)); my_error(ER_VIEW_SELECT_DERIVED, MYF(0));
YYABORT; MYSQL_YYABORT;
} }
SELECT_LEX *sel= lex->current_select; SELECT_LEX *sel= lex->current_select;
...@@ -5818,8 +5885,8 @@ select_derived_init: ...@@ -5818,8 +5885,8 @@ select_derived_init:
if (!sel->embedding || sel->end_nested_join(lex->thd)) if (!sel->embedding || sel->end_nested_join(lex->thd))
{ {
/* we are not in parentheses */ /* we are not in parentheses */
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
embedding= Select->embedding; embedding= Select->embedding;
$$= embedding && $$= embedding &&
...@@ -5883,7 +5950,7 @@ using_list: ...@@ -5883,7 +5950,7 @@ using_list:
ident ident
{ {
if (!($$= new List<String>)) if (!($$= new List<String>))
YYABORT; MYSQL_YYABORT;
$$->push_back(new (YYTHD->mem_root) $$->push_back(new (YYTHD->mem_root)
String((const char *) $1.str, $1.length, String((const char *) $1.str, $1.length,
system_charset_info)); system_charset_info));
...@@ -6003,9 +6070,9 @@ group_clause: ...@@ -6003,9 +6070,9 @@ group_clause:
group_list: group_list:
group_list ',' order_ident order_dir group_list ',' order_ident order_dir
{ if (add_group_to_list(YYTHD, $3,(bool) $4)) YYABORT; } { if (add_group_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
| order_ident order_dir | order_ident order_dir
{ if (add_group_to_list(YYTHD, $1,(bool) $2)) YYABORT; }; { if (add_group_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; };
olap_opt: olap_opt:
/* empty */ {} /* empty */ {}
...@@ -6016,11 +6083,11 @@ olap_opt: ...@@ -6016,11 +6083,11 @@ olap_opt:
{ {
my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE", my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
"global union parameters"); "global union parameters");
YYABORT; MYSQL_YYABORT;
} }
lex->current_select->olap= CUBE_TYPE; lex->current_select->olap= CUBE_TYPE;
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE"); my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
YYABORT; /* To be deleted in 5.1 */ MYSQL_YYABORT; /* To be deleted in 5.1 */
} }
| WITH ROLLUP_SYM | WITH ROLLUP_SYM
{ {
...@@ -6029,7 +6096,7 @@ olap_opt: ...@@ -6029,7 +6096,7 @@ olap_opt:
{ {
my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP", my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
"global union parameters"); "global union parameters");
YYABORT; MYSQL_YYABORT;
} }
lex->current_select->olap= ROLLUP_TYPE; lex->current_select->olap= ROLLUP_TYPE;
} }
...@@ -6054,7 +6121,7 @@ alter_order_item: ...@@ -6054,7 +6121,7 @@ alter_order_item:
THD *thd= YYTHD; THD *thd= YYTHD;
bool ascending= ($2 == 1) ? true : false; bool ascending= ($2 == 1) ? true : false;
if (add_order_to_list(thd, $1, ascending)) if (add_order_to_list(thd, $1, ascending))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -6077,7 +6144,7 @@ order_clause: ...@@ -6077,7 +6144,7 @@ order_clause:
{ {
my_error(ER_WRONG_USAGE, MYF(0), my_error(ER_WRONG_USAGE, MYF(0),
"CUBE/ROLLUP", "ORDER BY"); "CUBE/ROLLUP", "ORDER BY");
YYABORT; MYSQL_YYABORT;
} }
if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex) if (lex->sql_command != SQLCOM_ALTER_TABLE && !unit->fake_select_lex)
{ {
...@@ -6094,15 +6161,15 @@ order_clause: ...@@ -6094,15 +6161,15 @@ order_clause:
(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(lex->thd))
YYABORT; MYSQL_YYABORT;
} }
} order_list; } order_list;
order_list: order_list:
order_list ',' order_ident order_dir order_list ',' order_ident order_dir
{ if (add_order_to_list(YYTHD, $3,(bool) $4)) YYABORT; } { if (add_order_to_list(YYTHD, $3,(bool) $4)) MYSQL_YYABORT; }
| order_ident order_dir | order_ident order_dir
{ if (add_order_to_list(YYTHD, $1,(bool) $2)) YYABORT; }; { if (add_order_to_list(YYTHD, $1,(bool) $2)) MYSQL_YYABORT; };
order_dir: order_dir:
/* empty */ { $$ = 1; } /* empty */ { $$ = 1; }
...@@ -6199,13 +6266,13 @@ procedure_clause: ...@@ -6199,13 +6266,13 @@ procedure_clause:
if (! lex->parsing_options.allows_select_procedure) if (! lex->parsing_options.allows_select_procedure)
{ {
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "PROCEDURE"); my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "PROCEDURE");
YYABORT; MYSQL_YYABORT;
} }
if (&lex->select_lex != lex->current_select) if (&lex->select_lex != lex->current_select)
{ {
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery"); my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery");
YYABORT; MYSQL_YYABORT;
} }
lex->proc_list.elements=0; lex->proc_list.elements=0;
lex->proc_list.first=0; lex->proc_list.first=0;
...@@ -6214,7 +6281,7 @@ procedure_clause: ...@@ -6214,7 +6281,7 @@ procedure_clause:
current_select-> current_select->
context, context,
NULL,NULL,$2.str))) NULL,NULL,$2.str)))
YYABORT; MYSQL_YYABORT;
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT); Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
} }
'(' procedure_list ')'; '(' procedure_list ')';
...@@ -6233,7 +6300,7 @@ procedure_item: ...@@ -6233,7 +6300,7 @@ procedure_item:
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (add_proc_to_list(lex->thd, $2)) if (add_proc_to_list(lex->thd, $2))
YYABORT; MYSQL_YYABORT;
if (!$2->name) if (!$2->name)
$2->set_name($1,(uint) ((char*) lex->tok_end - $1), $2->set_name($1,(uint) ((char*) lex->tok_end - $1),
YYTHD->charset()); YYTHD->charset());
...@@ -6245,7 +6312,7 @@ select_var_list_init: ...@@ -6245,7 +6312,7 @@ select_var_list_init:
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!lex->describe && (!(lex->result= new select_dumpvar()))) if (!lex->describe && (!(lex->result= new select_dumpvar())))
YYABORT; MYSQL_YYABORT;
} }
select_var_list select_var_list
{} {}
...@@ -6277,7 +6344,7 @@ select_var_ident: ...@@ -6277,7 +6344,7 @@ select_var_ident:
if (!lex->spcont || !(t=lex->spcont->find_variable(&$1))) if (!lex->spcont || !(t=lex->spcont->find_variable(&$1)))
{ {
my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str); my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
if (lex->result) if (lex->result)
{ {
...@@ -6306,7 +6373,7 @@ into: ...@@ -6306,7 +6373,7 @@ into:
if (! Lex->parsing_options.allows_select_into) if (! Lex->parsing_options.allows_select_into)
{ {
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "INTO"); my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), "INTO");
YYABORT; MYSQL_YYABORT;
} }
} }
into_destination into_destination
...@@ -6319,7 +6386,7 @@ into_destination: ...@@ -6319,7 +6386,7 @@ into_destination:
lex->uncacheable(UNCACHEABLE_SIDEEFFECT); lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
if (!(lex->exchange= new sql_exchange($2.str, 0)) || if (!(lex->exchange= new sql_exchange($2.str, 0)) ||
!(lex->result= new select_export(lex->exchange))) !(lex->result= new select_export(lex->exchange)))
YYABORT; MYSQL_YYABORT;
} }
opt_field_term opt_line_term opt_field_term opt_line_term
| DUMPFILE TEXT_STRING_filesystem | DUMPFILE TEXT_STRING_filesystem
...@@ -6329,9 +6396,9 @@ into_destination: ...@@ -6329,9 +6396,9 @@ into_destination:
{ {
lex->uncacheable(UNCACHEABLE_SIDEEFFECT); lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
if (!(lex->exchange= new sql_exchange($2.str,1))) if (!(lex->exchange= new sql_exchange($2.str,1)))
YYABORT; MYSQL_YYABORT;
if (!(lex->result= new select_dump(lex->exchange))) if (!(lex->result= new select_dump(lex->exchange)))
YYABORT; MYSQL_YYABORT;
} }
} }
| select_var_list_init | select_var_list_init
...@@ -6378,7 +6445,7 @@ drop: ...@@ -6378,7 +6445,7 @@ drop:
$3.str)); $3.str));
if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL, if (!lex->current_select->add_table_to_list(lex->thd, $5, NULL,
TL_OPTION_UPDATING)) TL_OPTION_UPDATING))
YYABORT; MYSQL_YYABORT;
} }
| DROP DATABASE if_exists ident | DROP DATABASE if_exists ident
{ {
...@@ -6393,7 +6460,7 @@ drop: ...@@ -6393,7 +6460,7 @@ drop:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION"); my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command = SQLCOM_DROP_FUNCTION; lex->sql_command = SQLCOM_DROP_FUNCTION;
lex->drop_if_exists= $3; lex->drop_if_exists= $3;
...@@ -6405,7 +6472,7 @@ drop: ...@@ -6405,7 +6472,7 @@ drop:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE"); my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command = SQLCOM_DROP_PROCEDURE; lex->sql_command = SQLCOM_DROP_PROCEDURE;
lex->drop_if_exists= $3; lex->drop_if_exists= $3;
...@@ -6438,7 +6505,7 @@ table_name: ...@@ -6438,7 +6505,7 @@ table_name:
table_ident table_ident
{ {
if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING)) if (!Select->add_table_to_list(YYTHD, $1, NULL, TL_OPTION_UPDATING))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -6536,7 +6603,7 @@ insert_field_spec: ...@@ -6536,7 +6603,7 @@ insert_field_spec:
LEX *lex=Lex; LEX *lex=Lex;
if (!(lex->insert_list = new List_item) || if (!(lex->insert_list = new List_item) ||
lex->many_values.push_back(lex->insert_list)) lex->many_values.push_back(lex->insert_list))
YYABORT; MYSQL_YYABORT;
} }
ident_eq_list; ident_eq_list;
...@@ -6566,7 +6633,7 @@ ident_eq_value: ...@@ -6566,7 +6633,7 @@ ident_eq_value:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->field_list.push_back($1) || if (lex->field_list.push_back($1) ||
lex->insert_list->push_back($3)) lex->insert_list->push_back($3))
YYABORT; MYSQL_YYABORT;
}; };
equal: EQ {} equal: EQ {}
...@@ -6582,13 +6649,13 @@ no_braces: ...@@ -6582,13 +6649,13 @@ no_braces:
'(' '('
{ {
if (!(Lex->insert_list = new List_item)) if (!(Lex->insert_list = new List_item))
YYABORT; MYSQL_YYABORT;
} }
opt_values ')' opt_values ')'
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->many_values.push_back(lex->insert_list)) if (lex->many_values.push_back(lex->insert_list))
YYABORT; MYSQL_YYABORT;
}; };
opt_values: opt_values:
...@@ -6599,12 +6666,12 @@ values: ...@@ -6599,12 +6666,12 @@ values:
values ',' expr_or_default values ',' expr_or_default
{ {
if (Lex->insert_list->push_back($3)) if (Lex->insert_list->push_back($3))
YYABORT; MYSQL_YYABORT;
} }
| expr_or_default | expr_or_default
{ {
if (Lex->insert_list->push_back($1)) if (Lex->insert_list->push_back($1))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -6641,7 +6708,7 @@ update: ...@@ -6641,7 +6708,7 @@ update:
/* it is single table update and it is update of derived table */ /* it is single table update and it is update of derived table */
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
lex->select_lex.get_table_list()->alias, "UPDATE"); lex->select_lex.get_table_list()->alias, "UPDATE");
YYABORT; MYSQL_YYABORT;
} }
/* /*
In case of multi-update setting write lock for all tables may In case of multi-update setting write lock for all tables may
...@@ -6661,7 +6728,7 @@ update_elem: ...@@ -6661,7 +6728,7 @@ update_elem:
simple_ident_nospvar equal expr_or_default simple_ident_nospvar equal expr_or_default
{ {
if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3)) if (add_item_to_list(YYTHD, $1) || add_value_to_list(YYTHD, $3))
YYABORT; MYSQL_YYABORT;
}; };
insert_update_list: insert_update_list:
...@@ -6674,7 +6741,7 @@ insert_update_elem: ...@@ -6674,7 +6741,7 @@ insert_update_elem:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->update_list.push_back($1) || if (lex->update_list.push_back($1) ||
lex->value_list.push_back($3)) lex->value_list.push_back($3))
YYABORT; MYSQL_YYABORT;
}; };
opt_low_priority: opt_low_priority:
...@@ -6701,7 +6768,7 @@ single_multi: ...@@ -6701,7 +6768,7 @@ single_multi:
{ {
if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING, if (!Select->add_table_to_list(YYTHD, $2, NULL, TL_OPTION_UPDATING,
Lex->lock_option)) Lex->lock_option))
YYABORT; MYSQL_YYABORT;
} }
where_clause opt_order_clause where_clause opt_order_clause
delete_limit_clause {} delete_limit_clause {}
...@@ -6710,14 +6777,14 @@ single_multi: ...@@ -6710,14 +6777,14 @@ single_multi:
FROM join_table_list where_clause FROM join_table_list where_clause
{ {
if (multi_delete_set_locks_and_link_aux_tables(Lex)) if (multi_delete_set_locks_and_link_aux_tables(Lex))
YYABORT; MYSQL_YYABORT;
} }
| FROM table_wild_list | FROM table_wild_list
{ mysql_init_multi_delete(Lex); } { mysql_init_multi_delete(Lex); }
USING join_table_list where_clause USING join_table_list where_clause
{ {
if (multi_delete_set_locks_and_link_aux_tables(Lex)) if (multi_delete_set_locks_and_link_aux_tables(Lex))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -6731,7 +6798,7 @@ table_wild_one: ...@@ -6731,7 +6798,7 @@ table_wild_one:
if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3, if (!Select->add_table_to_list(YYTHD, new Table_ident($1), $3,
TL_OPTION_UPDATING | TL_OPTION_UPDATING |
TL_OPTION_ALIAS, Lex->lock_option)) TL_OPTION_ALIAS, Lex->lock_option))
YYABORT; MYSQL_YYABORT;
} }
| ident '.' ident opt_wild opt_table_alias | ident '.' ident opt_wild opt_table_alias
{ {
...@@ -6741,7 +6808,7 @@ table_wild_one: ...@@ -6741,7 +6808,7 @@ table_wild_one:
TL_OPTION_UPDATING | TL_OPTION_UPDATING |
TL_OPTION_ALIAS, TL_OPTION_ALIAS,
Lex->lock_option)) Lex->lock_option))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -6796,7 +6863,7 @@ show_param: ...@@ -6796,7 +6863,7 @@ show_param:
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_DATABASES; lex->orig_sql_command= SQLCOM_SHOW_DATABASES;
if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA)) if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA))
YYABORT; MYSQL_YYABORT;
} }
| opt_full TABLES opt_db wild_and_where | opt_full TABLES opt_db wild_and_where
{ {
...@@ -6805,7 +6872,7 @@ show_param: ...@@ -6805,7 +6872,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_TABLES; lex->orig_sql_command= SQLCOM_SHOW_TABLES;
lex->select_lex.db= $3; lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES))
YYABORT; MYSQL_YYABORT;
} }
| opt_full TRIGGERS_SYM opt_db wild_and_where | opt_full TRIGGERS_SYM opt_db wild_and_where
{ {
...@@ -6814,7 +6881,7 @@ show_param: ...@@ -6814,7 +6881,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_TRIGGERS; lex->orig_sql_command= SQLCOM_SHOW_TRIGGERS;
lex->select_lex.db= $3; lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TRIGGERS)) if (prepare_schema_table(YYTHD, lex, 0, SCH_TRIGGERS))
YYABORT; MYSQL_YYABORT;
} }
| TABLE_SYM STATUS_SYM opt_db wild_and_where | TABLE_SYM STATUS_SYM opt_db wild_and_where
{ {
...@@ -6823,7 +6890,7 @@ show_param: ...@@ -6823,7 +6890,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_TABLE_STATUS; lex->orig_sql_command= SQLCOM_SHOW_TABLE_STATUS;
lex->select_lex.db= $3; lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES))
YYABORT; MYSQL_YYABORT;
} }
| OPEN_SYM TABLES opt_db wild_and_where | OPEN_SYM TABLES opt_db wild_and_where
{ {
...@@ -6832,7 +6899,7 @@ show_param: ...@@ -6832,7 +6899,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_OPEN_TABLES; lex->orig_sql_command= SQLCOM_SHOW_OPEN_TABLES;
lex->select_lex.db= $3; lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
YYABORT; MYSQL_YYABORT;
} }
| ENGINE_SYM storage_engines | ENGINE_SYM storage_engines
{ Lex->create_info.db_type= $2; } { Lex->create_info.db_type= $2; }
...@@ -6845,7 +6912,7 @@ show_param: ...@@ -6845,7 +6912,7 @@ show_param:
if ($5) if ($5)
$4->change_db($5); $4->change_db($5);
if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS)) if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
YYABORT; MYSQL_YYABORT;
} }
| NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ | NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ
TEXT_STRING_sys AND_SYM MASTER_LOG_POS_SYM EQ ulonglong_num TEXT_STRING_sys AND_SYM MASTER_LOG_POS_SYM EQ ulonglong_num
...@@ -6878,7 +6945,7 @@ show_param: ...@@ -6878,7 +6945,7 @@ show_param:
if ($4) if ($4)
$3->change_db($4); $3->change_db($4);
if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS)) if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS))
YYABORT; MYSQL_YYABORT;
} }
| COLUMN_SYM TYPES_SYM | COLUMN_SYM TYPES_SYM
{ {
...@@ -6916,7 +6983,7 @@ show_param: ...@@ -6916,7 +6983,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_STATUS; lex->orig_sql_command= SQLCOM_SHOW_STATUS;
lex->option_type= $1; lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS)) if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
YYABORT; MYSQL_YYABORT;
} }
| INNOBASE_SYM STATUS_SYM | INNOBASE_SYM STATUS_SYM
{ Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS; WARN_DEPRECATED("SHOW INNODB STATUS", "SHOW ENGINE INNODB STATUS"); } { Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS; WARN_DEPRECATED("SHOW INNODB STATUS", "SHOW ENGINE INNODB STATUS"); }
...@@ -6931,7 +6998,7 @@ show_param: ...@@ -6931,7 +6998,7 @@ show_param:
lex->orig_sql_command= SQLCOM_SHOW_VARIABLES; lex->orig_sql_command= SQLCOM_SHOW_VARIABLES;
lex->option_type= $1; lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES))
YYABORT; MYSQL_YYABORT;
} }
| charset wild_and_where | charset wild_and_where
{ {
...@@ -6939,7 +7006,7 @@ show_param: ...@@ -6939,7 +7006,7 @@ show_param:
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_CHARSETS; lex->orig_sql_command= SQLCOM_SHOW_CHARSETS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS)) if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS))
YYABORT; MYSQL_YYABORT;
} }
| COLLATION_SYM wild_and_where | COLLATION_SYM wild_and_where
{ {
...@@ -6947,7 +7014,7 @@ show_param: ...@@ -6947,7 +7014,7 @@ show_param:
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_COLLATIONS; lex->orig_sql_command= SQLCOM_SHOW_COLLATIONS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS)) if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS))
YYABORT; MYSQL_YYABORT;
} }
| BERKELEY_DB_SYM LOGS_SYM | BERKELEY_DB_SYM LOGS_SYM
{ Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS"); } { Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS"); }
...@@ -6959,7 +7026,7 @@ show_param: ...@@ -6959,7 +7026,7 @@ show_param:
lex->sql_command= SQLCOM_SHOW_GRANTS; lex->sql_command= SQLCOM_SHOW_GRANTS;
LEX_USER *curr_user; LEX_USER *curr_user;
if (!(curr_user= (LEX_USER*) lex->thd->alloc(sizeof(st_lex_user)))) if (!(curr_user= (LEX_USER*) lex->thd->alloc(sizeof(st_lex_user))))
YYABORT; MYSQL_YYABORT;
bzero(curr_user, sizeof(st_lex_user)); bzero(curr_user, sizeof(st_lex_user));
lex->grant_user= curr_user; lex->grant_user= curr_user;
} }
...@@ -6981,7 +7048,7 @@ show_param: ...@@ -6981,7 +7048,7 @@ show_param:
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE; lex->sql_command = SQLCOM_SHOW_CREATE;
if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL,0)) if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL,0))
YYABORT; MYSQL_YYABORT;
lex->only_view= 0; lex->only_view= 0;
} }
| CREATE VIEW_SYM table_ident | CREATE VIEW_SYM table_ident
...@@ -6989,7 +7056,7 @@ show_param: ...@@ -6989,7 +7056,7 @@ show_param:
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_CREATE; lex->sql_command = SQLCOM_SHOW_CREATE;
if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0)) if (!lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0))
YYABORT; MYSQL_YYABORT;
lex->only_view= 1; lex->only_view= 1;
} }
| MASTER_SYM STATUS_SYM | MASTER_SYM STATUS_SYM
...@@ -7020,9 +7087,9 @@ show_param: ...@@ -7020,9 +7087,9 @@ show_param:
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_STATUS_PROC; lex->orig_sql_command= SQLCOM_SHOW_STATUS_PROC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ)) if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
YYABORT; MYSQL_YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
YYABORT; MYSQL_YYABORT;
} }
| FUNCTION_SYM STATUS_SYM wild_and_where | FUNCTION_SYM STATUS_SYM wild_and_where
{ {
...@@ -7030,15 +7097,15 @@ show_param: ...@@ -7030,15 +7097,15 @@ show_param:
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_STATUS_FUNC; lex->orig_sql_command= SQLCOM_SHOW_STATUS_FUNC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ)) if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
YYABORT; MYSQL_YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
YYABORT; MYSQL_YYABORT;
} }
| PROCEDURE CODE_SYM sp_name | PROCEDURE CODE_SYM sp_name
{ {
#ifdef DBUG_OFF #ifdef DBUG_OFF
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
#else #else
Lex->sql_command= SQLCOM_SHOW_PROC_CODE; Lex->sql_command= SQLCOM_SHOW_PROC_CODE;
Lex->spname= $3; Lex->spname= $3;
...@@ -7047,8 +7114,8 @@ show_param: ...@@ -7047,8 +7114,8 @@ show_param:
| FUNCTION_SYM CODE_SYM sp_name | FUNCTION_SYM CODE_SYM sp_name
{ {
#ifdef DBUG_OFF #ifdef DBUG_OFF
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
#else #else
Lex->sql_command= SQLCOM_SHOW_FUNC_CODE; Lex->sql_command= SQLCOM_SHOW_FUNC_CODE;
Lex->spname= $3; Lex->spname= $3;
...@@ -7068,7 +7135,7 @@ show_engine_param: ...@@ -7068,7 +7135,7 @@ show_engine_param:
break; break;
default: default:
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS"); my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
YYABORT; MYSQL_YYABORT;
} }
} }
| LOGS_SYM | LOGS_SYM
...@@ -7079,7 +7146,7 @@ show_engine_param: ...@@ -7079,7 +7146,7 @@ show_engine_param:
break; break;
default: default:
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LOGS"); my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LOGS");
YYABORT; MYSQL_YYABORT;
} }
}; };
...@@ -7138,7 +7205,7 @@ describe: ...@@ -7138,7 +7205,7 @@ describe:
lex->select_lex.db= 0; lex->select_lex.db= 0;
lex->verbose= 0; lex->verbose= 0;
if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS)) if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS))
YYABORT; MYSQL_YYABORT;
} }
opt_describe_column {} opt_describe_column {}
| describe_command opt_extended_describe | describe_command opt_extended_describe
...@@ -7280,7 +7347,7 @@ load: LOAD DATA_SYM ...@@ -7280,7 +7347,7 @@ load: LOAD DATA_SYM
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA"); my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD DATA");
YYABORT; MYSQL_YYABORT;
} }
lex->fname_start= lex->ptr; lex->fname_start= lex->ptr;
} }
...@@ -7293,14 +7360,14 @@ load: LOAD DATA_SYM ...@@ -7293,14 +7360,14 @@ load: LOAD DATA_SYM
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE"); my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE");
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command = SQLCOM_LOAD_MASTER_TABLE; lex->sql_command = SQLCOM_LOAD_MASTER_TABLE;
WARN_DEPRECATED("LOAD TABLE FROM MASTER", WARN_DEPRECATED("LOAD TABLE FROM MASTER",
"mysqldump or future " "mysqldump or future "
"BACKUP/RESTORE DATABASE facility"); "BACKUP/RESTORE DATABASE facility");
if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING)) if (!Select->add_table_to_list(YYTHD, $3, NULL, TL_OPTION_UPDATING))
YYABORT; MYSQL_YYABORT;
}; };
load_data: load_data:
...@@ -7313,7 +7380,7 @@ load_data: ...@@ -7313,7 +7380,7 @@ load_data:
lex->duplicates= DUP_ERROR; lex->duplicates= DUP_ERROR;
lex->ignore= 0; lex->ignore= 0;
if (!(lex->exchange= new sql_exchange($4.str, 0))) if (!(lex->exchange= new sql_exchange($4.str, 0)))
YYABORT; MYSQL_YYABORT;
} }
opt_duplicate INTO opt_duplicate INTO
{ {
...@@ -7325,7 +7392,7 @@ load_data: ...@@ -7325,7 +7392,7 @@ load_data:
LEX *lex=Lex; LEX *lex=Lex;
if (!Select->add_table_to_list(YYTHD, $10, NULL, TL_OPTION_UPDATING, if (!Select->add_table_to_list(YYTHD, $10, NULL, TL_OPTION_UPDATING,
lex->lock_option)) lex->lock_option))
YYABORT; MYSQL_YYABORT;
lex->field_list.empty(); lex->field_list.empty();
lex->update_list.empty(); lex->update_list.empty();
lex->value_list.empty(); lex->value_list.empty();
...@@ -7504,13 +7571,13 @@ param_marker: ...@@ -7504,13 +7571,13 @@ param_marker:
if (! lex->parsing_options.allows_variable) if (! lex->parsing_options.allows_variable)
{ {
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0)); my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
YYABORT; MYSQL_YYABORT;
} }
item= new Item_param((uint) (lex->tok_start - (uchar *) thd->query)); item= new Item_param((uint) (lex->tok_start - (uchar *) thd->query));
if (!($$= item) || lex->param_list.push_back(item)) if (!($$= item) || lex->param_list.push_back(item))
{ {
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
} }
; ;
...@@ -7576,7 +7643,7 @@ NUM_literal: ...@@ -7576,7 +7643,7 @@ NUM_literal:
$$= new Item_decimal($1.str, $1.length, YYTHD->charset()); $$= new Item_decimal($1.str, $1.length, YYTHD->charset());
if (YYTHD->net.report_error) if (YYTHD->net.report_error)
{ {
YYABORT; MYSQL_YYABORT;
} }
} }
| FLOAT_NUM | FLOAT_NUM
...@@ -7584,7 +7651,7 @@ NUM_literal: ...@@ -7584,7 +7651,7 @@ NUM_literal:
$$ = new Item_float($1.str, $1.length); $$ = new Item_float($1.str, $1.length);
if (YYTHD->net.report_error) if (YYTHD->net.report_error)
{ {
YYABORT; MYSQL_YYABORT;
} }
} }
; ;
...@@ -7629,7 +7696,7 @@ simple_ident: ...@@ -7629,7 +7696,7 @@ simple_ident:
if (! lex->parsing_options.allows_variable) if (! lex->parsing_options.allows_variable)
{ {
my_error(ER_VIEW_SELECT_VARIABLE, MYF(0)); my_error(ER_VIEW_SELECT_VARIABLE, MYF(0));
YYABORT; MYSQL_YYABORT;
} }
Item_splocal *splocal; Item_splocal *splocal;
...@@ -7689,14 +7756,14 @@ simple_ident_q: ...@@ -7689,14 +7756,14 @@ simple_ident_q:
!new_row) !new_row)
{ {
my_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");
YYABORT; MYSQL_YYABORT;
} }
if (lex->trg_chistics.event == TRG_EVENT_DELETE && if (lex->trg_chistics.event == TRG_EVENT_DELETE &&
new_row) new_row)
{ {
my_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");
YYABORT; MYSQL_YYABORT;
} }
DBUG_ASSERT(!new_row || DBUG_ASSERT(!new_row ||
...@@ -7711,7 +7778,7 @@ simple_ident_q: ...@@ -7711,7 +7778,7 @@ simple_ident_q:
$3.str, $3.str,
SELECT_ACL, SELECT_ACL,
read_only))) read_only)))
YYABORT; MYSQL_YYABORT;
/* /*
Let us add this item to list of all Item_trigger_field objects Let us add this item to list of all Item_trigger_field objects
...@@ -7782,13 +7849,13 @@ field_ident: ...@@ -7782,13 +7849,13 @@ field_ident:
if (my_strcasecmp(table_alias_charset, $1.str, table->db)) if (my_strcasecmp(table_alias_charset, $1.str, table->db))
{ {
my_error(ER_WRONG_DB_NAME, MYF(0), $1.str); my_error(ER_WRONG_DB_NAME, MYF(0), $1.str);
YYABORT; 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_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str); my_error(ER_WRONG_TABLE_NAME, MYF(0), $3.str);
YYABORT; MYSQL_YYABORT;
} }
$$=$5; $$=$5;
} }
...@@ -7798,7 +7865,7 @@ field_ident: ...@@ -7798,7 +7865,7 @@ field_ident:
if (my_strcasecmp(table_alias_charset, $1.str, table->alias)) if (my_strcasecmp(table_alias_charset, $1.str, table->alias))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str); my_error(ER_WRONG_TABLE_NAME, MYF(0), $1.str);
YYABORT; MYSQL_YYABORT;
} }
$$=$3; $$=$3;
} }
...@@ -7830,7 +7897,7 @@ IDENT_sys: ...@@ -7830,7 +7897,7 @@ IDENT_sys:
{ {
my_error(ER_INVALID_CHARACTER_STRING, MYF(0), my_error(ER_INVALID_CHARACTER_STRING, MYF(0),
cs->csname, $1.str + wlen); cs->csname, $1.str + wlen);
YYABORT; MYSQL_YYABORT;
} }
$$= $1; $$= $1;
} }
...@@ -7907,32 +7974,32 @@ user: ...@@ -7907,32 +7974,32 @@ user:
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
YYABORT; MYSQL_YYABORT;
$$->user = $1; $$->user = $1;
$$->host.str= (char *) "%"; $$->host.str= (char *) "%";
$$->host.length= 1; $$->host.length= 1;
if (check_string_length(&$$->user, if (check_string_length(&$$->user,
ER(ER_USERNAME), USERNAME_LENGTH)) ER(ER_USERNAME), USERNAME_LENGTH))
YYABORT; MYSQL_YYABORT;
} }
| ident_or_text '@' ident_or_text | ident_or_text '@' ident_or_text
{ {
THD *thd= YYTHD; THD *thd= YYTHD;
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
YYABORT; MYSQL_YYABORT;
$$->user = $1; $$->host=$3; $$->user = $1; $$->host=$3;
if (check_string_length(&$$->user, if (check_string_length(&$$->user,
ER(ER_USERNAME), USERNAME_LENGTH) || ER(ER_USERNAME), USERNAME_LENGTH) ||
check_string_length(&$$->host, check_string_length(&$$->host,
ER(ER_HOSTNAME), HOSTNAME_LENGTH)) ER(ER_HOSTNAME), HOSTNAME_LENGTH))
YYABORT; MYSQL_YYABORT;
} }
| CURRENT_USER optional_braces | CURRENT_USER optional_braces
{ {
if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user)))) if (!($$=(LEX_USER*) YYTHD->alloc(sizeof(st_lex_user))))
YYABORT; MYSQL_YYABORT;
/* /*
empty LEX_USER means current_user and empty LEX_USER means current_user and
will be handled in the get_current_user() function will be handled in the get_current_user() function
...@@ -8275,7 +8342,7 @@ option_type_value: ...@@ -8275,7 +8342,7 @@ option_type_value:
if (!(i= new sp_instr_stmt(sp->instructions(), lex->spcont, if (!(i= new sp_instr_stmt(sp->instructions(), lex->spcont,
lex))) lex)))
YYABORT; MYSQL_YYABORT;
/* /*
Extract the query statement from the tokenizer. The Extract the query statement from the tokenizer. The
...@@ -8288,7 +8355,7 @@ option_type_value: ...@@ -8288,7 +8355,7 @@ option_type_value:
qbuff.length= lex->tok_end - sp->m_tmp_query; qbuff.length= lex->tok_end - sp->m_tmp_query;
if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5))) if (!(qbuff.str= alloc_root(YYTHD->mem_root, qbuff.length + 5)))
YYABORT; MYSQL_YYABORT;
strmake(strmake(qbuff.str, "SET ", 4), (char *)sp->m_tmp_query, strmake(strmake(qbuff.str, "SET ", 4), (char *)sp->m_tmp_query,
qbuff.length); qbuff.length);
...@@ -8344,8 +8411,8 @@ sys_option_value: ...@@ -8344,8 +8411,8 @@ sys_option_value:
LINT_INIT(sp_fld); LINT_INIT(sp_fld);
if ($1) if ($1)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
if ($4) if ($4)
it= $4; it= $4;
...@@ -8367,7 +8434,7 @@ sys_option_value: ...@@ -8367,7 +8434,7 @@ sys_option_value:
lex->spcont, lex->spcont,
trg_fld, trg_fld,
it, lex))) it, lex)))
YYABORT; MYSQL_YYABORT;
/* /*
Let us add this item to list of all Item_trigger_field Let us add this item to list of all Item_trigger_field
...@@ -8394,8 +8461,8 @@ sys_option_value: ...@@ -8394,8 +8461,8 @@ sys_option_value:
Item *it; Item *it;
if ($1) if ($1)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
spv= ctx->find_variable(&$2.base_name); spv= ctx->find_variable(&$2.base_name);
...@@ -8451,9 +8518,9 @@ option_value: ...@@ -8451,9 +8518,9 @@ option_value:
if (spc && spc->find_variable(&names)) if (spc && spc->find_variable(&names))
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str); my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), names.str);
else else
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
| NAMES_SYM charset_name_or_default opt_collate | NAMES_SYM charset_name_or_default opt_collate
{ {
...@@ -8464,7 +8531,7 @@ option_value: ...@@ -8464,7 +8531,7 @@ option_value:
{ {
my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0), my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$3->name, $2->csname); $3->name, $2->csname);
YYABORT; MYSQL_YYABORT;
} }
lex->var_list.push_back(new set_var_collation_client($3,$3,$3)); lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
} }
...@@ -8481,10 +8548,10 @@ option_value: ...@@ -8481,10 +8548,10 @@ option_value:
if (spc && spc->find_variable(&pw)) if (spc && spc->find_variable(&pw))
{ {
my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str); my_error(ER_SP_BAD_VAR_SHADOW, MYF(0), pw.str);
YYABORT; MYSQL_YYABORT;
} }
if (!(user=(LEX_USER*) thd->alloc(sizeof(LEX_USER)))) if (!(user=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))
YYABORT; MYSQL_YYABORT;
user->host=null_lex_str; user->host=null_lex_str;
user->user.str=thd->security_ctx->priv_user; user->user.str=thd->security_ctx->priv_user;
thd->lex->var_list.push_back(new set_var_password(user, $3)); thd->lex->var_list.push_back(new set_var_password(user, $3));
...@@ -8508,7 +8575,7 @@ internal_variable_name: ...@@ -8508,7 +8575,7 @@ internal_variable_name:
/* Not an SP local variable */ /* Not an SP local variable */
sys_var *tmp=find_sys_var($1.str, $1.length); sys_var *tmp=find_sys_var($1.str, $1.length);
if (!tmp) if (!tmp)
YYABORT; MYSQL_YYABORT;
$$.var= tmp; $$.var= tmp;
$$.base_name= null_lex_str; $$.base_name= null_lex_str;
/* /*
...@@ -8517,7 +8584,7 @@ internal_variable_name: ...@@ -8517,7 +8584,7 @@ internal_variable_name:
*/ */
if (tmp == &sys_time_zone && if (tmp == &sys_time_zone &&
lex->add_time_zone_tables_to_query_tables(YYTHD)) lex->add_time_zone_tables_to_query_tables(YYTHD))
YYABORT; MYSQL_YYABORT;
else if (spc && tmp == &sys_autocommit) else if (spc && tmp == &sys_autocommit)
{ {
/* /*
...@@ -8539,8 +8606,8 @@ internal_variable_name: ...@@ -8539,8 +8606,8 @@ internal_variable_name:
LEX *lex= Lex; LEX *lex= Lex;
if (check_reserved_words(&$1)) if (check_reserved_words(&$1))
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER && if (lex->sphead && lex->sphead->m_type == TYPE_ENUM_TRIGGER &&
(!my_strcasecmp(system_charset_info, $1.str, "NEW") || (!my_strcasecmp(system_charset_info, $1.str, "NEW") ||
...@@ -8549,18 +8616,18 @@ internal_variable_name: ...@@ -8549,18 +8616,18 @@ internal_variable_name:
if ($1.str[0]=='O' || $1.str[0]=='o') if ($1.str[0]=='O' || $1.str[0]=='o')
{ {
my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", ""); my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", "");
YYABORT; 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),
"NEW", "on DELETE"); "NEW", "on DELETE");
YYABORT; MYSQL_YYABORT;
} }
if (lex->trg_chistics.action_time == TRG_ACTION_AFTER) if (lex->trg_chistics.action_time == TRG_ACTION_AFTER)
{ {
my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after "); my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after ");
YYABORT; 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;
...@@ -8570,7 +8637,7 @@ internal_variable_name: ...@@ -8570,7 +8637,7 @@ internal_variable_name:
{ {
sys_var *tmp=find_sys_var($3.str, $3.length); sys_var *tmp=find_sys_var($3.str, $3.length);
if (!tmp) if (!tmp)
YYABORT; MYSQL_YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str); my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp; $$.var= tmp;
...@@ -8581,7 +8648,7 @@ internal_variable_name: ...@@ -8581,7 +8648,7 @@ internal_variable_name:
{ {
sys_var *tmp=find_sys_var($3.str, $3.length); sys_var *tmp=find_sys_var($3.str, $3.length);
if (!tmp) if (!tmp)
YYABORT; MYSQL_YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str); my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp; $$.var= tmp;
...@@ -8633,7 +8700,7 @@ lock: ...@@ -8633,7 +8700,7 @@ lock:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK"); my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK");
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_LOCK_TABLES; lex->sql_command= SQLCOM_LOCK_TABLES;
} }
...@@ -8653,7 +8720,7 @@ table_lock: ...@@ -8653,7 +8720,7 @@ table_lock:
table_ident opt_table_alias lock_option table_ident opt_table_alias lock_option
{ {
if (!Select->add_table_to_list(YYTHD, $1, $2, 0, (thr_lock_type) $3)) if (!Select->add_table_to_list(YYTHD, $1, $2, 0, (thr_lock_type) $3))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -8672,7 +8739,7 @@ unlock: ...@@ -8672,7 +8739,7 @@ unlock:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK"); my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK");
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_UNLOCK_TABLES; lex->sql_command= SQLCOM_UNLOCK_TABLES;
} }
...@@ -8692,11 +8759,11 @@ handler: ...@@ -8692,11 +8759,11 @@ handler:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER"); my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
YYABORT; 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(lex->thd, $2, $4, 0))
YYABORT; MYSQL_YYABORT;
} }
| HANDLER_SYM table_ident_nodb CLOSE_SYM | HANDLER_SYM table_ident_nodb CLOSE_SYM
{ {
...@@ -8704,11 +8771,11 @@ handler: ...@@ -8704,11 +8771,11 @@ handler:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER"); my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
YYABORT; 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(lex->thd, $2, 0, 0))
YYABORT; MYSQL_YYABORT;
} }
| HANDLER_SYM table_ident_nodb READ_SYM | HANDLER_SYM table_ident_nodb READ_SYM
{ {
...@@ -8716,14 +8783,14 @@ handler: ...@@ -8716,14 +8783,14 @@ handler:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER"); my_error(ER_SP_BADSTATEMENT, MYF(0), "HANDLER");
YYABORT; MYSQL_YYABORT;
} }
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 */
lex->current_select->select_limit= new Item_int((int32) 1); lex->current_select->select_limit= new Item_int((int32) 1);
lex->current_select->offset_limit= 0; lex->current_select->offset_limit= 0;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0)) if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
YYABORT; MYSQL_YYABORT;
} }
handler_read_or_scan where_clause opt_limit_clause {} handler_read_or_scan where_clause opt_limit_clause {}
; ;
...@@ -8749,7 +8816,7 @@ handler_rkey_function: ...@@ -8749,7 +8816,7 @@ handler_rkey_function:
lex->ha_read_mode = RKEY; lex->ha_read_mode = RKEY;
lex->ha_rkey_mode=$1; lex->ha_rkey_mode=$1;
if (!(lex->insert_list = new List_item)) if (!(lex->insert_list = new List_item))
YYABORT; MYSQL_YYABORT;
} '(' values ')' { } } '(' values ')' { }
; ;
...@@ -8781,8 +8848,8 @@ revoke_command: ...@@ -8781,8 +8848,8 @@ revoke_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_REVOKE; lex->sql_command= SQLCOM_REVOKE;
lex->type= TYPE_ENUM_FUNCTION; lex->type= TYPE_ENUM_FUNCTION;
...@@ -8794,8 +8861,8 @@ revoke_command: ...@@ -8794,8 +8861,8 @@ revoke_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_REVOKE; lex->sql_command= SQLCOM_REVOKE;
lex->type= TYPE_ENUM_PROCEDURE; lex->type= TYPE_ENUM_PROCEDURE;
...@@ -8827,8 +8894,8 @@ grant_command: ...@@ -8827,8 +8894,8 @@ grant_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_GRANT; lex->sql_command= SQLCOM_GRANT;
lex->type= TYPE_ENUM_FUNCTION; lex->type= TYPE_ENUM_FUNCTION;
...@@ -8840,8 +8907,8 @@ grant_command: ...@@ -8840,8 +8907,8 @@ grant_command:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->columns.elements) if (lex->columns.elements)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
lex->sql_command= SQLCOM_GRANT; lex->sql_command= SQLCOM_GRANT;
lex->type= TYPE_ENUM_PROCEDURE; lex->type= TYPE_ENUM_PROCEDURE;
...@@ -8918,7 +8985,7 @@ require_list_element: ...@@ -8918,7 +8985,7 @@ require_list_element:
if (lex->x509_subject) if (lex->x509_subject)
{ {
my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT"); my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT");
YYABORT; MYSQL_YYABORT;
} }
lex->x509_subject=$2.str; lex->x509_subject=$2.str;
} }
...@@ -8928,7 +8995,7 @@ require_list_element: ...@@ -8928,7 +8995,7 @@ require_list_element:
if (lex->x509_issuer) if (lex->x509_issuer)
{ {
my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER"); my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER");
YYABORT; MYSQL_YYABORT;
} }
lex->x509_issuer=$2.str; lex->x509_issuer=$2.str;
} }
...@@ -8938,7 +9005,7 @@ require_list_element: ...@@ -8938,7 +9005,7 @@ require_list_element:
if (lex->ssl_cipher) if (lex->ssl_cipher)
{ {
my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER"); my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER");
YYABORT; MYSQL_YYABORT;
} }
lex->ssl_cipher=$2.str; lex->ssl_cipher=$2.str;
} }
...@@ -8950,14 +9017,14 @@ grant_ident: ...@@ -8950,14 +9017,14 @@ grant_ident:
LEX *lex= Lex; LEX *lex= Lex;
THD *thd= lex->thd; THD *thd= lex->thd;
if (thd->copy_db_to(&lex->current_select->db, NULL)) if (thd->copy_db_to(&lex->current_select->db, NULL))
YYABORT; MYSQL_YYABORT;
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_message(ER_ILLEGAL_GRANT_FOR_TABLE, my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0)); ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
} }
| ident '.' '*' | ident '.' '*'
...@@ -8970,7 +9037,7 @@ grant_ident: ...@@ -8970,7 +9037,7 @@ grant_ident:
{ {
my_message(ER_ILLEGAL_GRANT_FOR_TABLE, my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0)); ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
} }
| '*' '.' '*' | '*' '.' '*'
...@@ -8983,14 +9050,14 @@ grant_ident: ...@@ -8983,14 +9050,14 @@ grant_ident:
{ {
my_message(ER_ILLEGAL_GRANT_FOR_TABLE, my_message(ER_ILLEGAL_GRANT_FOR_TABLE,
ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0)); ER(ER_ILLEGAL_GRANT_FOR_TABLE), MYF(0));
YYABORT; MYSQL_YYABORT;
} }
} }
| table_ident | table_ident
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,0)) if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,0))
YYABORT; MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS) if (lex->grant == GLOBAL_ACLS)
lex->grant = TABLE_ACLS & ~GRANT_ACL; lex->grant = TABLE_ACLS & ~GRANT_ACL;
} }
...@@ -8998,21 +9065,21 @@ grant_ident: ...@@ -8998,21 +9065,21 @@ grant_ident:
user_list: user_list:
user { if (Lex->users_list.push_back($1)) YYABORT;} user { if (Lex->users_list.push_back($1)) MYSQL_YYABORT;}
| user_list ',' user | user_list ',' user
{ {
if (Lex->users_list.push_back($3)) if (Lex->users_list.push_back($3))
YYABORT; MYSQL_YYABORT;
} }
; ;
grant_list: grant_list:
grant_user { if (Lex->users_list.push_back($1)) YYABORT;} grant_user { if (Lex->users_list.push_back($1)) MYSQL_YYABORT;}
| grant_list ',' grant_user | grant_list ',' grant_user
{ {
if (Lex->users_list.push_back($3)) if (Lex->users_list.push_back($3))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -9235,17 +9302,17 @@ union_list: ...@@ -9235,17 +9302,17 @@ union_list:
{ {
/* Only the last SELECT can have INTO...... */ /* Only the last SELECT can have INTO...... */
my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO"); my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");
YYABORT; MYSQL_YYABORT;
} }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
/* This counter shouldn't be incremented for UNION parts */ /* This counter shouldn't be incremented for UNION parts */
Lex->nest_level--; Lex->nest_level--;
if (mysql_new_select(lex, 0)) if (mysql_new_select(lex, 0))
YYABORT; MYSQL_YYABORT;
mysql_init_select(lex); mysql_init_select(lex);
lex->current_select->linkage=UNION_TYPE; lex->current_select->linkage=UNION_TYPE;
if ($2) /* UNION DISTINCT - remember position */ if ($2) /* UNION DISTINCT - remember position */
...@@ -9339,8 +9406,8 @@ subselect_start: ...@@ -9339,8 +9406,8 @@ subselect_start:
if (lex->sql_command == (int)SQLCOM_HA_READ || if (lex->sql_command == (int)SQLCOM_HA_READ ||
lex->sql_command == (int)SQLCOM_KILL) lex->sql_command == (int)SQLCOM_KILL)
{ {
yyerror(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
YYABORT; MYSQL_YYABORT;
} }
/* /*
we are making a "derived table" for the parenthesis we are making a "derived table" for the parenthesis
...@@ -9350,7 +9417,7 @@ subselect_start: ...@@ -9350,7 +9417,7 @@ subselect_start:
SELECT * FROM ((SELECT ...) UNION ...) SELECT * FROM ((SELECT ...) UNION ...)
*/ */
if (mysql_new_select(Lex, 1)) if (mysql_new_select(Lex, 1))
YYABORT; MYSQL_YYABORT;
}; };
subselect_end: subselect_end:
...@@ -9468,7 +9535,7 @@ view_tail: ...@@ -9468,7 +9535,7 @@ view_tail:
lex->sql_command= SQLCOM_CREATE_VIEW; lex->sql_command= SQLCOM_CREATE_VIEW;
/* first table in list is target VIEW name */ /* first table in list is target VIEW name */
if (!lex->select_lex.add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING)) if (!lex->select_lex.add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING))
YYABORT; MYSQL_YYABORT;
} }
view_list_opt AS view_select view_check_option view_list_opt AS view_select view_check_option
{} {}
...@@ -9559,11 +9626,11 @@ trigger_tail: ...@@ -9559,11 +9626,11 @@ trigger_tail:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER"); my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER");
YYABORT; MYSQL_YYABORT;
} }
if (!(sp= new sp_head())) if (!(sp= new sp_head()))
YYABORT; MYSQL_YYABORT;
sp->reset_thd_mem_root(YYTHD); sp->reset_thd_mem_root(YYTHD);
sp->init(lex); sp->init(lex);
sp->init_sp_name(YYTHD, $3); sp->init_sp_name(YYTHD, $3);
...@@ -9602,7 +9669,7 @@ trigger_tail: ...@@ -9602,7 +9669,7 @@ trigger_tail:
sp->restore_thd_mem_root(YYTHD); sp->restore_thd_mem_root(YYTHD);
if (sp->is_not_allowed_in_function("trigger")) if (sp->is_not_allowed_in_function("trigger"))
YYABORT; MYSQL_YYABORT;
/* /*
We have to do it after parsing trigger body, because some of We have to do it after parsing trigger body, because some of
...@@ -9613,7 +9680,7 @@ trigger_tail: ...@@ -9613,7 +9680,7 @@ trigger_tail:
(LEX_STRING*) 0, (LEX_STRING*) 0,
TL_OPTION_UPDATING, TL_OPTION_UPDATING,
TL_IGNORE)) TL_IGNORE))
YYABORT; MYSQL_YYABORT;
} }
; ;
...@@ -9641,7 +9708,7 @@ sp_tail: ...@@ -9641,7 +9708,7 @@ sp_tail:
if (lex->sphead) if (lex->sphead)
{ {
my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE"); my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
YYABORT; MYSQL_YYABORT;
} }
lex->stmt_definition_begin= $2; lex->stmt_definition_begin= $2;
...@@ -9727,23 +9794,23 @@ xa: XA_SYM begin_or_start xid opt_join_or_resume ...@@ -9727,23 +9794,23 @@ xa: XA_SYM begin_or_start xid opt_join_or_resume
xid: text_string xid: text_string
{ {
YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE); MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
YYABORT; MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0); Lex->xid->set(1L, $1->ptr(), $1->length(), 0, 0);
} }
| text_string ',' text_string | text_string ',' text_string
{ {
YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
YYABORT; MYSQL_YYABORT;
Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length()); Lex->xid->set(1L, $1->ptr(), $1->length(), $3->ptr(), $3->length());
} }
| text_string ',' text_string ',' ulong_num | text_string ',' text_string ',' ulong_num
{ {
YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE); MYSQL_YYABORT_UNLESS($1->length() <= MAXGTRIDSIZE && $3->length() <= MAXBQUALSIZE);
if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID)))) if (!(Lex->xid=(XID *)YYTHD->alloc(sizeof(XID))))
YYABORT; MYSQL_YYABORT;
Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length()); Lex->xid->set($5, $1->ptr(), $1->length(), $3->ptr(), $3->length());
} }
; ;
......
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