From 923fe817e0d7d4ae6ba8fa16d6c5381bd58ac4b9 Mon Sep 17 00:00:00 2001 From: "dlenev@mysql.com" <> Date: Sat, 9 Jul 2005 21:51:59 +0400 Subject: Enable support of access to tables from triggers. Thus fix bug #8406 "Triggers crash if referencing a table" and several other related bugs. Fix for bug #11834 "Re-execution of prepared statement with dropped function crashes server." which was spotted during work on previous bugs. Also couple of nice cleanups: - Replaced two separate hashes for stored routines used by statement with one. - Now instead of doing one pass through all routines used in statement for caching them and then doing another pass for adding their tables to table list, we do only one pass during which do both things. --- sql/sql_lex.cc | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 1270aab18ae..c82052a39a4 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -172,10 +172,9 @@ void lex_start(THD *thd, uchar *buf,uint length) lex->proc_list.first= 0; lex->query_tables_own_last= 0; - if (lex->spfuns.records) - my_hash_reset(&lex->spfuns); - if (lex->spprocs.records) - my_hash_reset(&lex->spprocs); + if (lex->sroutines.records) + my_hash_reset(&lex->sroutines); + lex->sroutines_list.empty(); DBUG_VOID_RETURN; } @@ -1570,6 +1569,28 @@ void st_select_lex::print_limit(THD *thd, String *str) } +/* + Initialize LEX object. + + SYNOPSIS + st_lex::st_lex() + + NOTE + LEX object initialized with this constructor can be used as part of + THD object for which one can safely call open_tables(), lock_tables() + and close_thread_tables() functions. But it is not yet ready for + statement parsing. On should use lex_start() function to prepare LEX + for this. +*/ + +st_lex::st_lex() + :result(0), sql_command(SQLCOM_END), query_tables_own_last(0) +{ + hash_init(&sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, 0, 0); + sroutines_list.empty(); +} + + /* Check whether the merging algorithm can be used on this VIEW -- cgit v1.2.1