protected function DbDumpCommand::getTableCollation

protected DbDumpCommand::getTableCollation(Connection $connection, $table, &$definition)

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.

File

core/lib/Drupal/Core/Command/DbDumpCommand.php, line 258

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

© 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!Command!DbDumpCommand.php/function/DbDumpCommand::getTableCollation/8.1.x