function TransactionManager::rollbackClientSavepoint
Same name in this branch
- 11.x core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php \Drupal\mysql\Driver\Database\mysql\TransactionManager::rollbackClientSavepoint()
Same name and namespace in other branches
- 10 core/modules/mysql/src/Driver/Database/mysql/TransactionManager.php \Drupal\mysql\Driver\Database\mysql\TransactionManager::rollbackClientSavepoint()
Rolls back to a savepoint on the client transaction.
This is a generic implementation. Drivers should override this method to use a method specific for their client connection.
Parameters
string $name: The name of the savepoint.
Return value
bool Returns TRUE on success or FALSE on failure.
Overrides TransactionManagerBase::rollbackClientSavepoint
File
-
core/
modules/ mysqli/ src/ Driver/ Database/ mysqli/ TransactionManager.php, line 32
Class
- TransactionManager
- MySqli implementation of TransactionManagerInterface.
Namespace
Drupal\mysqli\Driver\Database\mysqliCode
protected function rollbackClientSavepoint(string $name) : bool {
// Mysqli does not have a rollback_to_savepoint method, and it does not
// allow a prepared statement for 'ROLLBACK TO SAVEPOINT', so we need to
// fallback to querying on the client connection directly.
try {
return (bool) $this->connection
->getClientConnection()
->query('ROLLBACK TO SAVEPOINT ' . $name);
} catch (\mysqli_sql_exception) {
// If the rollback failed, most likely the savepoint was not there
// because the transaction is no longer active. In this case we void the
// transaction stack.
$this->voidClientTransaction();
return TRUE;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.