| Versions | |
|---|---|
| 7 | db_transaction($name = NULL, array $options = array()) |
Returns a new transaction object for the active database.
string $name Optional name of the transaction.
array $options An array of options to control how the transaction operates:
DatabaseTransaction A new DatabaseTransaction object for this connection.
drupal/
<?php
function db_transaction($name = NULL, array $options = array()) {
if (empty($options['target'])) {
$options['target'] = 'default';
}
return Database::getConnection($options['target'])->startTransaction($name);
}
?>