Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into fix-issue-packets-out-of-order
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Aug 29, 2024
2 parents 01176c4 + 1b5a917 commit f48fcb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- Enh #344: Update `bit` type according to main PR yiisoft/db#860 (@Tigrov)
- Enh #347: Raise minimum PHP version to `^8.1` with minor refactoring (@Tigrov)
- Bug #349, #352: Restore connection if closed by connection timeout (@Tigrov)
- Enh #347, #353: Raise minimum PHP version to `^8.1` with minor refactoring (@Tigrov)
- Bug #349: Restore connection if closed by connection timeout (@Tigrov)

## 1.2.0 March 21, 2024

Expand Down
13 changes: 5 additions & 8 deletions src/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,16 @@ final class Driver extends AbstractPdoDriver
{
public function createConnection(): PDO
{
$this->attributes += [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION];

if (PHP_VERSION_ID >= 80100) {
$this->attributes += [PDO::ATTR_STRINGIFY_FETCHES => true];
}
$this->attributes += [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_STRINGIFY_FETCHES => true,
];

$pdo = parent::createConnection();

if ($this->charset !== null) {
$pdo->exec('SET NAMES ' . $pdo->quote($this->charset));
}

if ($this->charset === null && !str_contains($this->dsn, 'charset')) {
} elseif (!str_contains($this->dsn, 'charset')) {
$pdo->exec('SET NAMES ' . $pdo->quote('utf8mb4'));
}

Expand Down

0 comments on commit f48fcb0

Please sign in to comment.