You are here

public function Connection::pushTransaction in Drupal driver for SQL Server and SQL Azure 3.0.x

Same name and namespace in other branches
  1. 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::pushTransaction()
  2. 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php \Drupal\Driver\Database\sqlsrv\Connection::pushTransaction()

Using SQL Server query syntax.

Overrides Connection::pushTransaction

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Connection.php, line 534

Class

Connection
Sqlsvr implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function pushTransaction($name) {
  if (!$this
    ->supportsTransactions()) {
    return;
  }
  if (isset($this->transactionLayers[$name])) {
    throw new TransactionNameNonUniqueException($name . " is already in use.");
  }

  // If we're already in a transaction then we want to create a savepoint
  // rather than try to create another transaction.
  if ($this
    ->inTransaction()) {
    $this
      ->queryDirect('SAVE TRANSACTION ' . $name);
  }
  else {
    $this->connection
      ->beginTransaction();
  }
  $this->transactionLayers[$name] = $name;
}