protected function Tasks::checkEncoding in Drupal driver for SQL Server and SQL Azure 3.0.x
Same name and namespace in other branches
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Install/Tasks.php \Drupal\Driver\Database\sqlsrv\Install\Tasks::checkEncoding()
- 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Install/Tasks.php \Drupal\Driver\Database\sqlsrv\Install\Tasks::checkEncoding()
Check encoding is UTF8.
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Install/ Tasks.php, line 121
Class
- Tasks
- Specifies installation tasks for PostgreSQL databases.
Namespace
Drupal\Driver\Database\sqlsrv\InstallCode
protected function checkEncoding() {
try {
$database = Database::getConnection();
/** @var \Drupal\Driver\Database\sqlsrv\Schema $schema */
$schema = $database
->schema();
$collation = $schema
->getCollation();
if (stristr($collation, '_CI_') !== FALSE) {
$this
->pass(t('Database is encoded in case insensitive collation: $collation'));
}
else {
$this
->fail(t('The %driver database is using %current collation, but must use case insensitive collation to work with Drupal. Recreate the database with this collation. See !link for more details.', [
'%current' => $collation,
'%driver' => $this
->name(),
':link' => '<a href="INSTALL.sqlsrv.txt">INSTALL.sqlsrv.txt</a>',
]));
}
} catch (\Exception $e) {
$this
->fail(t('Drupal could not determine the encoding of the database was set to UTF-8'));
}
}