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

DatabaseTransaction A new DatabaseTransaction object for this connection.

Related topics

▾ 5 functions call db_transaction()

block_admin_configure_submit in modules/block/block.admin.inc
block_admin_display_form_submit in modules/block/block.admin.inc
Process main blocks administration form submissions.
comment_save in modules/comment/comment.module
Accepts a submission of new or changed comment content.
node_save in modules/node/node.module
Save changes to a node or add a new node.
user_save in modules/user/user.module
Save changes to a user account or add a new user.

Code

includes/database/database.inc, line 2190

<?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
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.