public function Connection::pushTransaction in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::pushTransaction()
Increases the depth of transaction nesting.
If no transaction is already active, we begin a new transaction.
Parameters
string $name: The name of the transaction.
Throws
\Drupal\Core\Database\TransactionNameNonUniqueException
See also
\Drupal\Core\Database\Transaction
1 call to Connection::pushTransaction()
- Connection::addSavepoint in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Connection.php - Add a new savepoint with an unique name.
File
- core/
lib/ Drupal/ Core/ Database/ Connection.php, line 1197
Class
- Connection
- Base Database API class.
Namespace
Drupal\Core\DatabaseCode
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;
}