function Connection::tablePrefix

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::tablePrefix()
  2. 10 core/lib/Drupal/Core/Database/Connection.php \Drupal\Core\Database\Connection::tablePrefix()

Find the prefix for a table.

This function is for when you want to know the prefix of a table. This is not used in prefixTables due to performance reasons.

Parameters

string $table: (optional) The table to find the prefix for.

3 calls to Connection::tablePrefix()
Connection::getFullQualifiedTableName in core/modules/sqlite/src/Driver/Database/sqlite/Connection.php
Get a fully qualified table name.
Connection::getFullQualifiedTableName in core/modules/pgsql/src/Driver/Database/pgsql/Connection.php
Get a fully qualified table name.
Connection::getFullQualifiedTableName in core/lib/Drupal/Core/Database/Connection.php
Get a fully qualified table name.

File

core/lib/Drupal/Core/Database/Connection.php, line 559

Class

Connection
Base Database API class.

Namespace

Drupal\Core\Database

Code

public function tablePrefix($table = 'default') {
    if (isset($this->prefixes[$table])) {
        return $this->prefixes[$table];
    }
    else {
        return $this->prefixes['default'];
    }
}

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