summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2005-03-05 16:33:36 +0300
committerunknown <dlenev@mysql.com>2005-03-05 16:33:36 +0300
commit527403541d0b41424efd39b906628d15cc1360c7 (patch)
treedbd397ae86756d44958cbeb80a4017e6a7546c3e /sql
parent0d7e68c92a4ded30d02a66b434cbe624c3df5e1e (diff)
parente3bc9d82e6c58aea14aa1106adc6c609a5026b89 (diff)
downloadmariadb-git-527403541d0b41424efd39b906628d15cc1360c7.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-sp sql/sp_head.cc: Auto merged sql/sql_parse.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/sp.cc2
-rw-r--r--sql/sp_head.cc15
-rw-r--r--sql/sql_parse.cc4
-rw-r--r--sql/sql_prepare.cc2
-rw-r--r--sql/sql_trigger.cc3
5 files changed, 14 insertions, 12 deletions
diff --git a/sql/sp.cc b/sql/sp.cc
index 8b8e8897180..3f6d4d0bf1b 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -307,8 +307,6 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp)
goto done;
if (sp)
{
- if (oldlex != newlex)
- sp->restore_lex(thd);
delete sp;
newlex->sphead= NULL;
}
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 30f3cac8a0d..21ef89aea72 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -459,11 +459,22 @@ sp_head::destroy()
delete_dynamic(&m_instr);
m_pcont->destroy();
free_items(free_list);
+
+ /*
+ If we have non-empty LEX stack then we just came out of parser with
+ error. Now we should delete all auxilary LEXes and restore original
+ THD::lex (In this case sp_head::restore_thd_mem_root() was not called
+ too, so m_thd points to the current thread context).
+ It is safe to not update LEX::ptr because further query string parsing
+ and execution will be stopped anyway.
+ */
+ DBUG_ASSERT(m_lex.is_empty() || m_thd);
while ((lex= (LEX *)m_lex.pop()))
{
- if (lex != &m_thd->main_lex) // We got interrupted and have lex'es left
- delete lex;
+ delete m_thd->lex;
+ m_thd->lex= lex;
}
+
hash_free(&m_sptabs);
hash_free(&m_spfuns);
hash_free(&m_spprocs);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 2ec5e0a4128..f328d31161a 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5115,8 +5115,6 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
{
if (thd->lex->sphead)
{
- if (lex != thd->lex)
- thd->lex->sphead->restore_lex(thd);
delete thd->lex->sphead;
thd->lex->sphead= NULL;
}
@@ -5152,8 +5150,6 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
if (thd->lex->sphead)
{
/* Clean up after failed stored procedure/function */
- if (lex != thd->lex)
- thd->lex->sphead->restore_lex(thd);
delete thd->lex->sphead;
thd->lex->sphead= NULL;
}
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index cf988654b22..8006c61f233 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1771,8 +1771,6 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
my_pthread_setprio(pthread_self(),WAIT_PRIOR);
if (error && thd->lex->sphead)
{
- if (lex != thd->lex)
- thd->lex->sphead->restore_lex(thd);
delete thd->lex->sphead;
thd->lex->sphead= NULL;
}
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index f61ff12f365..110841e8fd4 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -415,9 +415,8 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
*/
if (lex.sphead)
{
- if (&lex != thd->lex)
- thd->lex->sphead->restore_lex(thd);
delete lex.sphead;
+ lex.sphead= 0;
}
goto err_with_lex_cleanup;
}