public function Connection::pushTransaction

Same name in this branch
  1. 8.x drupal/core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::pushTransaction()
  2. 8.x drupal/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php \Drupal\Core\Database\Driver\sqlite\Connection::pushTransaction()

Increases the depth of transaction nesting.

If no transaction is already active, we begin a new transaction.

Throws

Drupal\Core\Database\TransactionNameNonUniqueException

See also

Drupal\Core\Database\Transaction

1 call to Connection::pushTransaction()
Connection::pushTransaction in drupal/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
Increases the depth of transaction nesting.
1 method overrides Connection::pushTransaction()
Connection::pushTransaction in drupal/core/lib/Drupal/Core/Database/Driver/sqlite/Connection.php
Increases the depth of transaction nesting.

File

drupal/core/lib/Drupal/Core/Database/Connection.php, line 956
Definition of Drupal\Core\Database\Connection

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

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
      ->query('SAVEPOINT ' . $name);
  }
  else {
    $this->connection
      ->beginTransaction();
  }
  $this->transactionLayers[$name] = $name;
}