From 36088732bb11e05ee4a14a3d1101615a1891f93f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 6 Apr 2010 16:54:15 +0000 Subject: [PATCH] - Patch #669794 by andypost, Josh Waihi, aspilicious, moshe weitzman, catch: use savepoints for nested transactions. --- includes/database/database.inc | 11 ++++++++--- includes/database/sqlite/database.inc | 8 ++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/includes/database/database.inc b/includes/database/database.inc index ab2b5829c32..a85489a5b65 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -896,6 +896,14 @@ abstract class DatabaseConnection extends PDO { if ($this->supportsTransactions()) { parent::rollBack(); } + else { + // Log unsupported rollback. + $this->rollbackLogs[] = array( + 'type' => 'database', + 'message' => t('Explicit rollback failed: not supported on active connection.'), + 'variables' => array(), + ); + } $this->logRollback(); } @@ -911,9 +919,6 @@ abstract class DatabaseConnection extends PDO { $logging_callback = $logging['callback']; - // Log the failed rollback. - call_user_func($logging_callback, 'database', 'Explicit rollback failed: not supported on active connection.', array(), $logging['error_severity']); - // Play back the logged errors to the specified logging callback post- // rollback. foreach ($this->rollbackLogs as $log_item) { diff --git a/includes/database/sqlite/database.inc b/includes/database/sqlite/database.inc index da3ca3525a0..ba28ca63b8a 100644 --- a/includes/database/sqlite/database.inc +++ b/includes/database/sqlite/database.inc @@ -265,6 +265,14 @@ class DatabaseConnection_sqlite extends DatabaseConnection { if ($this->supportsTransactions()) { PDO::rollBack(); } + else { + // Log unsupported rollback. + $this->rollbackLogs[] = array( + 'type' => 'database', + 'message' => t('Explicit rollback failed: not supported on active connection.'), + 'variables' => array(), + ); + } $this->logRollback(); }