protected function Schema::getPrefixInfo

Same name in this branch
  1. 9.x drupal/core/lib/Drupal/Core/Database/Schema.php \Drupal\Core\Database\Schema::getPrefixInfo()
  2. 9.x drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php \Drupal\Core\Database\Driver\mysql\Schema::getPrefixInfo()

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

2 calls to Schema::getPrefixInfo()
Schema::buildTableNameCondition in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Build a condition to match a table name against a standard information_schema.
Schema::renameTable in drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
Rename a table.

File

drupal/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php, line 41
Definition of Drupal\Core\Database\Driver\mysql\Schema

Class

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 {
    $db_info = Database::getConnectionInfo();
    $info['database'] = $db_info['default']['database'];
    $info['table'] = $table;
  }
  return $info;
}