You are here

public function Transaction::__construct in Drupal driver for SQL Server and SQL Azure 8.2

Same name and namespace in other branches
  1. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Transaction.php \Drupal\Driver\Database\sqlsrv\Transaction::__construct()

Overriden to add settings.

Parameters

Connection $connection:

string $name:

DatabaseTransactionSettings $settings:

Overrides Transaction::__construct

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Transaction.php, line 42
Definition of Drupal\Driver\Database\sqlsrv\Transaction

Class

Transaction

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function __construct(Connection $connection, $name = null, DatabaseTransactionSettings $settings = null) {

  // Store connection and settings.
  $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);
}