function Connection::makeSequenceName

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

Creates the appropriate sequence name for a given table and serial field.

This method should only be called by the driver's code.

@internal

Parameters

string $table: The table name to use for the sequence.

string $field: The field name to use for the sequence.

Return value

string A table prefix-parsed string for the sequence name.

File

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

Class

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

Namespace

Drupal\pgsql\Driver\Database\pgsql

Code

public function makeSequenceName($table, $field) {
    $sequence_name = $this->prefixTables('{' . $table . '}_' . $field . '_seq');
    // Remove identifier quotes as we are constructing a new name from a
    // prefixed and quoted table name.
    return str_replace($this->identifierQuotes, '', $sequence_name);
}

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