You are here

protected function DbDumpCommand::getTableCollation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Command/DbDumpCommand.php \Drupal\Core\Command\DbDumpCommand::getTableCollation()

Set the table collation.

Parameters

\Drupal\Core\Database\Connection $connection: The database connection to use.

string $table: The table to find indexes for.

array &$definition: The schema definition to modify.

1 call to DbDumpCommand::getTableCollation()
DbDumpCommand::getTableSchema in core/lib/Drupal/Core/Command/DbDumpCommand.php
Returns a schema array for a given table.

File

core/lib/Drupal/Core/Command/DbDumpCommand.php, line 263
Contains \Drupal\Core\Command\DbDumpCommand.

Class

DbDumpCommand
Provides a command to dump the current database to a script.

Namespace

Drupal\Core\Command

Code

protected function getTableCollation(Connection $connection, $table, &$definition) {
  $query = $connection
    ->query("SHOW TABLE STATUS LIKE '{" . $table . "}'");
  $data = $query
    ->fetchAssoc();

  // Set `mysql_character_set`. This will be ignored by other backends.
  $definition['mysql_character_set'] = str_replace('_general_ci', '', $data['Collation']);
}