Schema::getPrefixInfo

protected Schema::getPrefixInfo($table = 'default', $add_prefix = TRUE)

Get information about the table and database name from the prefix.

Return value

A keyed array with information about the database, table name and prefix.

Overrides Schema::getPrefixInfo

File

core/lib/Drupal/Core/Database/Driver/mysql/Schema.php, line 51

Class

Schema
MySQL implementation of \Drupal\Core\Database\Schema.

Namespace

Drupal\Core\Database\Driver\mysql

Code

protected function getPrefixInfo($table = 'default', $add_prefix = TRUE) {
  $info = array('prefix' => $this->connection->tablePrefix($table));
  if ($add_prefix) {
    $table = $info['prefix'] . $table;
  }
  if (($pos = strpos($table, '.')) !== FALSE) {
    $info['database'] = substr($table, 0, $pos);
    $info['table'] = substr($table, ++$pos);
  }
  else {
    $info['database'] = $this->connection->getConnectionOptions()['database'];
    $info['table'] = $table;
  }
  return $info;
}
doc_Drupal
2016-10-29 09:39:58
Comments
Leave a Comment

Please login to continue.