protected function JsonItemTest::getTableCollation in JSON Field 8
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 JsonItemTest::getTableCollation()
- JsonItemTest::getTableSchema in tests/
src/ Kernel/ JsonItemTest.php
File
- tests/
src/ Kernel/ JsonItemTest.php, line 284
Class
- JsonItemTest
- @coversDefaultClass \Drupal\json_field\Plugin\Field\FieldType\JSONItem
Namespace
Drupal\Tests\json_field\KernelCode
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.
if (isset($data['Collation'])) {
$definition['mysql_character_set'] = str_replace('_general_ci', '', $data['Collation']);
}
}