function Schema::getPrefixInfo
Same name in this branch
- 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::getPrefixInfo()
Same name in other branches
- 9 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::getPrefixInfo()
- 9 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::getPrefixInfo()
- 10 core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::getPrefixInfo()
- 10 core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::getPrefixInfo()
- 11.x core/modules/mysql/src/Driver/Database/mysql/Schema.php \Drupal\mysql\Driver\Database\mysql\Schema::getPrefixInfo()
- 11.x core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::getPrefixInfo()
Get information about the table name and schema from the prefix.
Parameters
Name of table to look prefix up for. Defaults to 'default' because that's: default key for prefix.
$add_prefix: Boolean that indicates whether the given table name should be prefixed.
Return value
A keyed array with information about the schema, table name and prefix.
15 calls to Schema::getPrefixInfo()
- Schema::buildTableNameCondition in core/
lib/ Drupal/ Core/ Database/ Schema.php - Build a condition to match a table name against a standard information_schema.
- Schema::createIndexSql in core/
lib/ Drupal/ Core/ Database/ Driver/ sqlite/ Schema.php - Build the SQL expression for indexes.
- Schema::dropIndex in core/
lib/ Drupal/ Core/ Database/ Driver/ sqlite/ Schema.php - Drop an index.
- Schema::dropUniqueKey in core/
lib/ Drupal/ Core/ Database/ Driver/ sqlite/ Schema.php - Drop a unique key.
- Schema::ensureIdentifiersLength in core/
lib/ Drupal/ Core/ Database/ Driver/ pgsql/ Schema.php - Make sure to limit identifiers according to PostgreSQL compiled in length.
1 method overrides Schema::getPrefixInfo()
- Schema::getPrefixInfo in core/
lib/ Drupal/ Core/ Database/ Driver/ mysql/ Schema.php - Get information about the table and database name from the prefix.
File
-
core/
lib/ Drupal/ Core/ Database/ Schema.php, line 84
Class
- Schema
- Provides a base implementation for Database Schema.
Namespace
Drupal\Core\DatabaseCode
protected function getPrefixInfo($table = 'default', $add_prefix = TRUE) {
$info = [
'schema' => $this->defaultSchema,
'prefix' => $this->connection
->tablePrefix($table),
];
if ($add_prefix) {
$table = $info['prefix'] . $table;
}
// If the prefix contains a period in it, then that means the prefix also
// contains a schema reference in which case we will change the schema key
// to the value before the period in the prefix. Everything after the dot
// will be prefixed onto the front of the table.
if (($pos = strpos($table, '.')) !== FALSE) {
// Grab everything before the period.
$info['schema'] = substr($table, 0, $pos);
// Grab everything after the dot.
$info['table'] = substr($table, ++$pos);
}
else {
$info['table'] = $table;
}
return $info;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.