From a82769dcaadc3460beec7ebe0fa020d37be69b3a Mon Sep 17 00:00:00 2001 From: "Bradley M. Froehle" Date: Tue, 31 May 2011 16:08:42 -0700 Subject: [PATCH] Issue #1007830 follow-up by bfroehle: Additional specificity in the exception catching. --- includes/database/mysql/database.inc | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/includes/database/mysql/database.inc b/includes/database/mysql/database.inc index 47ef8d5..77734ff 100644 --- a/includes/database/mysql/database.inc +++ b/includes/database/mysql/database.inc @@ -169,14 +169,17 @@ class DatabaseConnection_mysql extends DatabaseConnection { // savepoints which no longer exist. // // To avoid exceptions when no actual error has occurred, we silently - // succeed for PDOExceptions with error code 42000 ("Syntax error or - // access rule violation"). - if ($e->getCode() != '42000') { + // succeed for PDOExceptions with SQLSTATE 42000 ("Syntax error or + // access rule violation") and error code 1305 ("SAVEPOINT does not + // exist"). + if ($e->getCode() == '42000' && $e->errorInfo[1] == '1305') { + // If one SAVEPOINT was released automatically, then all were. + // Therefore, we keep just the topmost transaction. + $this->transactionLayers = array('drupal_transaction'); + } + else { throw $e; } - // If one SAVEPOINT was released automatically, then all were. - // Therefore, we keep just the topmost transaction. - $this->transactionLayers = array('drupal_transaction'); } break; } -- 1.7.5.3