| 7 database.inc | db_transaction($name = NULL, array $options = array()) |
| 8 database.inc | db_transaction($name = NULL, array $options = array()) |
Returns a new transaction object for the active database.
Parameters
string $name: Optional name of the transaction.
array $options: An array of options to control how the transaction operates:
- target: The database target name.
Return value
DatabaseTransaction A new DatabaseTransaction object for this connection.
Related topics
17 calls to db_transaction()
File
- includes/
database/ database.inc, line 2503 - Core systems for the database layer.
Code
function db_transaction($name = NULL, array $options = array()) {
if (empty($options['target'])) {
$options['target'] = 'default';
}
return Database::getConnection($options['target'])->startTransaction($name);
}
Login or register to post comments
Comments
The first argument will not
The first argument will not be used in the case of the first transaction for the database connection; the first one will always be set to drupal_transaction regardless of what you specify.
Some explications about
Some explications about "array $options" ?
Is there only "target" inside?