=== modified file 'includes/database/database.inc' --- includes/database/database.inc 2009-12-04 16:31:04 +0000 +++ includes/database/database.inc 2009-12-10 05:50:02 +0000 @@ -832,17 +832,9 @@ abstract class DatabaseConnection extend /** * Returns a new DatabaseTransaction object on this connection. * - * @param $required - * If executing an operation that absolutely must use transactions, specify - * TRUE for this parameter. If the connection does not support transactions, - * this method will throw an exception and the operation will not be possible. * @see DatabaseTransaction */ - public function startTransaction($required = FALSE) { - if ($required && !$this->supportsTransactions()) { - throw new TransactionsNotSupportedException(); - } - + public function startTransaction() { if (empty($this->transactionClass)) { $this->transactionClass = 'DatabaseTransaction_' . $this->driver(); if (!class_exists($this->transactionClass)) { @@ -1575,16 +1567,6 @@ abstract class Database { } /** - * Exception to mark databases that do not support transations. - * - * This exception will be thrown when a transaction is started that does not - * allow for the "silent fallback" of no transaction and the database connection - * in use does not support transactions. The calling code must then take - * appropriate action. - */ -class TransactionsNotSupportedException extends Exception { } - -/** * Exception to throw when popTransaction() is called when no transaction is active. */ class NoActiveTransactionException extends Exception { } === modified file 'includes/database/mysql/database.inc' --- includes/database/mysql/database.inc 2009-10-18 07:35:39 +0000 +++ includes/database/mysql/database.inc 2009-12-10 05:50:02 +0000 @@ -14,8 +14,8 @@ class DatabaseConnection_mysql extends DatabaseConnection { public function __construct(array $connection_options = array()) { - // This driver defaults to non transaction support. - $this->transactionSupport = !empty($connection_options['transactions']); + // This driver defaults to transaction support, except if explicitly passed FALSE. + $this->transactionSupport = !isset($connection_options['transactions']) || ($connection_options['transactions'] !== FALSE); // MySQL never supports transactional DDL. $this->transactionalDDLSupport = FALSE; === modified file 'modules/simpletest/tests/database_test.test' --- modules/simpletest/tests/database_test.test 2009-12-09 19:01:14 +0000 +++ modules/simpletest/tests/database_test.test 2009-12-10 05:50:14 +0000 @@ -2851,49 +2851,6 @@ class DatabaseTransactionTestCase extend } /** - * Test that a database that claims to support transactions will return a transaction object. - * - * If the active connection does not support transactions, this test does nothing. - */ - function testTransactionsSupported() { - try { - $connection = Database::getConnection(); - if ($connection->supportsTransactions()) { - - // Start a "required" transaction. This should fail if we do - // this on a database that does not actually support transactions. - $txn = db_transaction(TRUE); - } - $this->pass('Transaction started successfully.'); - } - catch (TransactionsNotSupportedException $e) { - $this->fail("Exception thrown when it shouldn't have been."); - } - } - - /** - * Test that a database that doesn't support transactions fails correctly. - * - * If the active connection supports transactions, this test does nothing. - */ - function testTransactionsNotSupported() { - try { - $connection = Database::getConnection(); - if (!$connection->supportsTransactions()) { - - // Start a "required" transaction. This should fail if we do this - // on a database that does not actually support transactions, and - // the current database does claim to NOT support transactions. - $txn = db_transaction(TRUE); - $this->fail('No transaction failure registered.'); - } - } - catch (TransactionsNotSupportedException $e) { - $this->pass('Exception thrown for unsupported transactions.'); - } - } - - /** * Test transaction rollback on a database that supports transactions. * * If the active connection does not support transactions, this test does nothing.