W3cubDocs

/Drupal 8

public function Connection::tablePrefix

public Connection::tablePrefix($table = 'default')

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.

File

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

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'];
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Connection.php/function/Connection::tablePrefix/8.1.x