Commit 83488344 authored by unknown's avatar unknown

Check for thd->killed in execution loop. (Makes more graceful behaviour in

certain interrupt cases.)
parent 79060c99
...@@ -136,6 +136,7 @@ sp_head::execute(THD *thd) ...@@ -136,6 +136,7 @@ sp_head::execute(THD *thd)
int ret= 0; int ret= 0;
uint ip= 0; uint ip= 0;
LINT_INIT(olddbname);
if (olddbptr) if (olddbptr)
olddbname= my_strdup(olddbptr, MYF(MY_WME)); olddbname= my_strdup(olddbptr, MYF(MY_WME));
...@@ -148,15 +149,19 @@ sp_head::execute(THD *thd) ...@@ -148,15 +149,19 @@ sp_head::execute(THD *thd)
break; break;
DBUG_PRINT("execute", ("Instruction %u", ip)); DBUG_PRINT("execute", ("Instruction %u", ip));
ret= i->execute(thd, &ip); ret= i->execute(thd, &ip);
} while (ret == 0); } while (ret == 0 && !thd->killed);
DBUG_PRINT("info", ("ret=%d killed=%d", ret, thd->killed));
if (thd->killed)
ret= -1;
/* If the DB has changed, the pointer has changed too, but the /* If the DB has changed, the pointer has changed too, but the
original thd->db will then have been freed */ original thd->db will then have been freed */
if (olddbptr && olddbptr != thd->db && olddbname) if (olddbptr && olddbptr != thd->db && olddbname)
{ {
/* QQ Maybe we should issue some special error message or warning here, /* QQ Maybe we should issue some special error message or warning here,
if this fails?? */ if this fails?? */
ret= mysql_change_db(thd, olddbname); if (! thd->killed)
ret= mysql_change_db(thd, olddbname);
my_free(olddbname, MYF(0)); my_free(olddbname, MYF(0));
} }
DBUG_RETURN(ret); DBUG_RETURN(ret);
......
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