Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Connection.php

function Connection::setPrefix

Same name in this branch
  1. 11.1.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::setPrefix()

Overrides Connection::setPrefix

File

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

Class

Connection
PostgreSQL implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\pgsql\Driver\Database\pgsql

Code

protected function setPrefix($prefix) {
    assert(is_string($prefix), 'The \'$prefix\' argument to ' . __METHOD__ . '() must be a string');
    $this->prefix = $prefix;
    // Add the schema name if it is not set to public, otherwise it will use the
    // default schema name.
    $quoted_schema = '';
    if (isset($this->connectionOptions['schema']) && $this->connectionOptions['schema'] !== 'public') {
        $quoted_schema = $this->identifierQuotes[0] . $this->connectionOptions['schema'] . $this->identifierQuotes[1] . '.';
    }
    $this->tablePlaceholderReplacements = [
        $quoted_schema . $this->identifierQuotes[0] . str_replace('.', $this->identifierQuotes[1] . '.' . $this->identifierQuotes[0], $prefix),
        $this->identifierQuotes[1],
    ];
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal