summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorpem@mysql.comhem.se <>2004-06-08 18:41:18 +0200
committerpem@mysql.comhem.se <>2004-06-08 18:41:18 +0200
commite3132d9a7caaf0bbd543c86f087c67edb20957d1 (patch)
tree03821b1f2e6f2432f551aa2de6d2b0caaa2ecf0a /sql/sp_head.cc
parentf87f27915e4158eec85d2a22e2eaf1fe7943beb0 (diff)
downloadmariadb-git-e3132d9a7caaf0bbd543c86f087c67edb20957d1.tar.gz
Fixed proper restoring of current db on errors.
This fixes part of BUG#3229: Stored procedure comment causes packets out of order.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index c22e57830f8..5263c59f4ad 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -376,7 +376,7 @@ sp_head::execute(THD *thd)
{
DBUG_ENTER("sp_head::execute");
char olddb[128];
- char *olddbptr;
+ bool dbchanged;
sp_rcontext *ctx= thd->spcont;
int ret= 0;
uint ip= 0;
@@ -388,8 +388,8 @@ sp_head::execute(THD *thd)
}
#endif
- olddbptr= thd->db;
- if ((ret= sp_use_new_db(thd, m_db.str, olddb, sizeof(olddb), 0)))
+ dbchanged= FALSE;
+ if ((ret= sp_use_new_db(thd, m_db.str, olddb, sizeof(olddb), 0, &dbchanged)))
goto done;
if (ctx)
@@ -445,7 +445,7 @@ sp_head::execute(THD *thd)
ret= -1;
/* If the DB has changed, the pointer has changed too, but the
original thd->db will then have been freed */
- if (olddbptr != thd->db)
+ if (dbchanged)
{
if (! thd->killed)
ret= sp_change_db(thd, olddb, 0);