Skip to content

Commit

Permalink
client_encoding in conninfo is not supported by libpq 8.x.x
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed May 10, 2012
1 parent 82acbc8 commit 4982813
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/Pg/PQ.pm
Expand Up @@ -30,13 +30,16 @@ sub _make_conninfo {
if (@_ == 1 and ref $_[0] eq 'HASH') {
%opts = %{$_[0]}
}
elsif (@_ & 1) {
$conninfo[0] = shift @_;
$conninfo[0] = "dbname=$conninfo[0]" unless $conninfo[0] =~ /=/;
else {
if (@_ & 1) {
$conninfo[0] = shift @_;
$conninfo[0] = "dbname=$conninfo[0]" unless $conninfo[0] =~ /=/;
}
%opts = @_;
}
push @conninfo, map _escape_opt($_).'='._escape_opt($opts{$_}), keys %opts;
push @conninfo, 'client_encoding=UTF8';
no warnings 'numeric';
push @conninfo, 'client_encoding=UTF8' if Pg::PQ::libVersion() >= 9;
# warn "conninfo: >@conninfo<\n";
join ' ', @conninfo;
}
Expand Down

0 comments on commit 4982813

Please sign in to comment.