From 6682ab936c8d49a8be32b2e149b45f1eba79de0c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 13 Jul 2009 07:27:15 +0000 Subject: - Patch #517502 by Crell: make transaction API follow its own documentation. --- includes/database/database.inc | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/database/database.inc b/includes/database/database.inc index b45711f15..326e1c05c 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -225,7 +225,7 @@ abstract class DatabaseConnection extends PDO { * * @var boolean */ - protected $willRollBack; + protected $willRollback; /** * The name of the Select class for this connection. @@ -849,12 +849,12 @@ abstract class DatabaseConnection extends PDO { * * This method throws an exception if no transaction is active. */ - public function rollBack() { + public function rollback() { if ($this->transactionLayers == 0) { throw new NoActiveTransactionException(); } - $this->willRollBack = TRUE; + $this->willRollback = TRUE; } /** @@ -867,12 +867,12 @@ abstract class DatabaseConnection extends PDO { * @return * TRUE if the transaction will roll back, FALSE otherwise. */ - public function willRollBack() { + public function willRollback() { if ($this->transactionLayers == 0) { throw new NoActiveTransactionException(); } - return $this->willRollBack; + return $this->willRollback; } /** @@ -1448,6 +1448,23 @@ class DatabaseTransaction { $this->connection->popTransaction(); } + /** + * Roll back the current transaction. + * + * This is just a wrapper method to rollback whatever transaction stack we + * are currently in, which is managed by the connection object itself. + */ + public function rollback() { + $this->connection->rollback(); + } + + /** + * Determine if this transaction will roll back. + */ + public function willRollback() { + return $this->connection->willRollback(); + } + } /** -- cgit v1.2.3