function Schema::getSequenceName

Same name and namespace in other branches
  1. 11.x core/modules/pgsql/src/Driver/Database/pgsql/Schema.php \Drupal\pgsql\Driver\Database\pgsql\Schema::getSequenceName()

Retrieves a sequence name that is owned by the table and column..

Parameters

string $table: A table name that is not prefixed or quoted.

string $column: The column name.

Return value

string|null The name of the sequence or NULL if it does not exist.

1 call to Schema::getSequenceName()
Schema::changeField in core/modules/pgsql/src/Driver/Database/pgsql/Schema.php
Change a field definition.

File

core/modules/pgsql/src/Driver/Database/pgsql/Schema.php, line 1107

Class

Schema
PostgreSQL implementation of <a href="/api/drupal/core%21lib%21Drupal%21Core%21Database%21Schema.php/class/Schema/10" title="Provides a base implementation for Database Schema." class="local">\Drupal\Core\Database\Schema</a>.

Namespace

Drupal\pgsql\Driver\Database\pgsql

Code

protected function getSequenceName(string $table, string $column) : ?string {
    return $this->connection
        ->query("SELECT pg_get_serial_sequence(:table, :column)", [
        ':table' => $this->defaultSchema . '.' . $this->connection
            ->getPrefix() . $table,
        ':column' => $column,
    ])
        ->fetchField();
}

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