db_transaction
- Versions
- 7
db_transaction($required = FALSE, Array $options = array())
Returns a new transaction object for the active database.
Parameters
$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.
Return value
A new DatabaseTransaction object for this connection.
Related topics
Code
includes/database/database.inc, line 2048
<?php
function db_transaction($required = FALSE, Array $options = array()) {
if (empty($options['target'])) {
$options['target'] = 'default';
}
return Database::getConnection($options['target'])->startTransaction($required);
}
?>Login or register to post comments 