Skip to content

Commit

Permalink
Merge pull request #17 from haruspeks/next
Browse files Browse the repository at this point in the history
add support for client_encoding option with pgsql (fix #16)
  • Loading branch information
mychidarko authored Aug 24, 2024
2 parents 5722c28 + cae9a49 commit 2602273
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Db/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ protected function dsn(): string
$dsn .= ';port=' . $this->config('port');
}
if ($this->config('charset')) {
$dsn .= ';charset=' . $this->config('charset');
if($dbtype === 'pgsql') {
$dsn .= ';options=\'--client_encoding='.$this->config('charset').'\'';
} else {
$dsn .= ';charset=' . $this->config('charset');
}
}
if ($this->config('unixSocket')) {
$dsn .= ';unix_socket=' . $this->config('unixSocket');
Expand Down

0 comments on commit 2602273

Please sign in to comment.