blob: fcd9995621f94527a645d3a46c07c26ad4d69322 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider;
/** @internal */
final class ConnectionCollationMetadataProvider implements CollationMetadataProvider
{
public function __construct(private readonly Connection $connection)
{
}
/** @throws Exception */
public function getCollationCharset(string $collation): ?string
{
$charset = $this->connection->fetchOne(
<<<'SQL'
SELECT CHARACTER_SET_NAME
FROM information_schema.COLLATIONS
WHERE COLLATION_NAME = ?;
SQL
,
[$collation],
);
if ($charset !== false) {
return $charset;
}
return null;
}
}
|