1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Fix for bug #10015 "Crash in InnoDB if stored routines are used".

We should not allow explicit or implicit transaction commits inside
of stored functions or triggers (so in autocommit mode we should not
do commits after execution of sub-statement).
Also since we don't support nested statement transactions in 5.0,
we shouldn't commit or rollback stmt transactions while we are inside
stored functions or triggers. This should be fixed in later (>=5.1)
releases.
This commit is contained in:
dlenev@brandersnatch.localdomain
2005-06-07 14:53:08 +04:00
parent 329d974df7
commit 270b695f59
10 changed files with 433 additions and 5 deletions

View File

@ -125,6 +125,11 @@ static bool end_active_trans(THD *thd)
{
int error=0;
DBUG_ENTER("end_active_trans");
if (unlikely(thd->transaction.in_sub_stmt))
{
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1);
}
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN |
OPTION_TABLE_LOCK))
{
@ -143,6 +148,15 @@ static bool end_active_trans(THD *thd)
static bool begin_trans(THD *thd)
{
int error=0;
/*
QQ: May be it is better to simply prohibit COMMIT and ROLLBACK in
stored routines as SQL2003 suggests?
*/
if (unlikely(thd->transaction.in_sub_stmt))
{
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
return 1;
}
if (thd->locked_tables)
{
thd->lock=thd->locked_tables;
@ -1338,6 +1352,15 @@ int end_trans(THD *thd, enum enum_mysql_completiontype completion)
int res= 0;
DBUG_ENTER("end_trans");
/*
QQ: May be it is better to simply prohibit COMMIT and ROLLBACK in
stored routines as SQL2003 suggests?
*/
if (unlikely(thd->transaction.in_sub_stmt))
{
my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0));
DBUG_RETURN(1);
}
switch (completion) {
case COMMIT:
/*