You are here

public function DatabaseTransaction_sqlsrv::__construct in Drupal driver for SQL Server and SQL Azure 7.3

Same name and namespace in other branches
  1. 7.2 sqlsrv/transaction.inc \DatabaseTransaction_sqlsrv::__construct()

Overriden to add settings.

Parameters

DatabaseConnection $connection:

mixed $name:

mixed $sane:

Overrides DatabaseTransaction::__construct

File

sqlsrv/transaction.inc, line 34

Class

DatabaseTransaction_sqlsrv
Overriden to bring some commonsense to transaction management.

Code

public function __construct(DatabaseConnection $connection, $name = NULL, $settings = NULL) {
  $this->settings = $settings;
  $this->connection = $connection;

  // If there is no transaction depth, then no transaction has started. Name
  // the transaction 'drupal_transaction'.
  if (!($depth = $connection
    ->transactionDepth())) {
    $this->name = 'drupal_transaction';
  }
  elseif (empty($name)) {
    $this->name = 'savepoint_' . $depth;
  }
  else {
    $this->name = $name;
  }
  $this->connection
    ->pushTransaction($this->name, $settings);
}