function Connection::addSavepoint

Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php \Drupal\Core\Database\Driver\pgsql\Connection::addSavepoint()
  2. 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::addSavepoint()
  3. 11.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::addSavepoint()

Add a new savepoint with a unique name.

The main use for this method is to mimic InnoDB functionality, which provides an inherent savepoint before any query in a transaction.

Parameters

$savepoint_name: A string representing the savepoint name. By default, "mimic_implicit_commit" is used.

See also

Drupal\Core\Database\Connection::pushTransaction()

1 call to Connection::addSavepoint()
Connection::query in core/modules/pgsql/src/Driver/Database/pgsql/Connection.php

File

core/modules/pgsql/src/Driver/Database/pgsql/Connection.php, line 336

Class

Connection
PostgreSQL implementation of <a href="/api/drupal/core%21lib%21Drupal%21Core%21Database%21Connection.php/class/Connection/9" title="Base Database API class." class="local">\Drupal\Core\Database\Connection</a>.

Namespace

Drupal\pgsql\Driver\Database\pgsql

Code

public function addSavepoint($savepoint_name = 'mimic_implicit_commit') {
    if ($this->inTransaction()) {
        $this->pushTransaction($savepoint_name);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.