function Connection::setPrefix
Same name in this branch
- 11.x core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::setPrefix()
Same name in other branches
- 9 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::setPrefix()
- 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::setPrefix()
- 10 core/modules/pgsql/src/Driver/Database/pgsql/Connection.php \Drupal\pgsql\Driver\Database\pgsql\Connection::setPrefix()
- 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::setPrefix()
Set the prefix used by this database connection.
Parameters
string $prefix: A single prefix.
2 calls to Connection::setPrefix()
- Connection::__construct in core/
modules/ sqlite/ src/ Driver/ Database/ sqlite/ Connection.php - Constructs a \Drupal\sqlite\Driver\Database\sqlite\Connection object.
- Connection::__construct in core/
lib/ Drupal/ Core/ Database/ Connection.php - Constructs a Connection object.
1 method overrides Connection::setPrefix()
- Connection::setPrefix in core/
modules/ pgsql/ src/ Driver/ Database/ pgsql/ Connection.php
File
-
core/
lib/ Drupal/ Core/ Database/ Connection.php, line 340
Class
- Connection
- Base Database API class.
Namespace
Drupal\Core\DatabaseCode
protected function setPrefix($prefix) {
assert(is_string($prefix), 'The \'$prefix\' argument to ' . __METHOD__ . '() must be a string');
$this->prefix = $prefix;
$this->tablePlaceholderReplacements = [
$this->identifierQuotes[0] . str_replace('.', $this->identifierQuotes[1] . '.' . $this->identifierQuotes[0], $prefix),
$this->identifierQuotes[1],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.