db_transaction

  1. drupal
    1. drupal7
Versionen
drupal7 db_transaction($required = FALSE, Array $options = array())

Returns a new transaction object for the active database.

Übergabeparameter

$required TRUE if the calling code will not function properly without transaction support. If set to TRUE and the active database does not support transactions a TransactionsNotSupportedException exception will be thrown.

$options An array of options to control how the transaction operates. Only the target key has any meaning in this case.

Rückgabewert

A new DatabaseTransaction object for this connection.

Verwandte Themen

▾ 4 functions call db_transaction()

DatabaseTransactionTestCase::testTransactionsNotSupported in modules/simpletest/tests/database_test.test
Test that a database that doesn't support transactions fails correctly.
DatabaseTransactionTestCase::testTransactionsSupported in modules/simpletest/tests/database_test.test
Test that a database that claims to support transactions will return a transaction object.
DatabaseTransactionTestCase::transactionInnerLayer in modules/simpletest/tests/database_test.test
Helper method for transaction unit tests. This "inner layer" transaction is either used alone or nested inside of the "outer layer" transaction.
DatabaseTransactionTestCase::transactionOuterLayer in modules/simpletest/tests/database_test.test
Helper method for transaction unit test. This "outer layer" transaction starts and then encapsulates the "inner layer" transaction. This nesting is used to evaluate whether the the database transaction API properly supports…

Code

includes/database/database.inc, line 1960

<?php
function db_transaction($required = FALSE, Array $options = array()) {
  if (empty($options['target'])) {
    $options['target'] = 'default';
  }
  return Database::getConnection($options['target'])->startTransaction($required);
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen