diff options
-rw-r--r-- | 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 47ef8d52e..bc31feaaf 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 MySQL 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; } |