diff options
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php')
| -rw-r--r-- | vendor/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php deleted file mode 100644 index d02c768..0000000 --- a/vendor/doctrine/dbal/src/Driver/Mysqli/Initializer/Charset.php +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Initializer; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\Mysqli\Exception\InvalidCharset; | ||
| 8 | use Doctrine\DBAL\Driver\Mysqli\Initializer; | ||
| 9 | use mysqli; | ||
| 10 | use mysqli_sql_exception; | ||
| 11 | |||
| 12 | final class Charset implements Initializer | ||
| 13 | { | ||
| 14 | public function __construct(private readonly string $charset) | ||
| 15 | { | ||
| 16 | } | ||
| 17 | |||
| 18 | public function initialize(mysqli $connection): void | ||
| 19 | { | ||
| 20 | try { | ||
| 21 | $success = $connection->set_charset($this->charset); | ||
| 22 | } catch (mysqli_sql_exception $e) { | ||
| 23 | throw InvalidCharset::upcast($e, $this->charset); | ||
| 24 | } | ||
| 25 | |||
| 26 | if ($success) { | ||
| 27 | return; | ||
| 28 | } | ||
| 29 | |||
| 30 | throw InvalidCharset::fromCharset($connection, $this->charset); | ||
| 31 | } | ||
| 32 | } | ||
