Skip to content

Commit

Permalink
Additional fix: Narrowing range of version of DBD::Pg to take care.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikedas committed May 23, 2018
1 parent c4f91fc commit bcc5789
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/lib/Sympa/DatabaseDriver/PostgreSQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ sub quote {
my $string = shift;
my $data_type = shift;

# Set utf8 flag, because DBD::Pg 3.x needs utf8 flag for input parameters
# even if pg_enable_utf8 option is disabled.
unless (0 == index($DBD::Pg::VERSION, '2')
or (ref $data_type eq 'HASH' and $data_type->{pg_type})) {
# Set utf8 flag. Because DBD::Pg 3.3.0 to 3.5.x need utf8 flag for input
# parameters, even if pg_enable_utf8 option is disabled.
if ($DBD::Pg::VERSION =~ /\A3[.][3-5]\b/
and not(ref $data_type eq 'HASH' and $data_type->{pg_type})) {
$string = Encode::decode_utf8($string);
}
return $self->SUPER::quote($string, $data_type);
Expand All @@ -85,9 +85,9 @@ sub do_prepared_query {
my $self = shift;
my $query = shift;

# Set utf8 flag, because DBD::Pg 3.x needs utf8 flag for input parameters
# even if pg_enable_utf8 option is disabled.
unless (0 == index($DBD::Pg::VERSION, '2')) {
# Set utf8 flag. Because DBD::Pg 3.3.0 to 3.5.x need utf8 flag for input
# parameters, even if pg_enable_utf8 option is disabled.
if ($DBD::Pg::VERSION =~ /\A3[.][3-5]\b/) {
my @params;
while (scalar @_) {
my $p = shift;
Expand Down

0 comments on commit bcc5789

Please sign in to comment.