Skip to content

Commit bcc5789

Browse files
committed
Additional fix: Narrowing range of version of DBD::Pg to take care.
1 parent c4f91fc commit bcc5789

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/lib/Sympa/DatabaseDriver/PostgreSQL.pm

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ sub quote {
7272
my $string = shift;
7373
my $data_type = shift;
7474

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

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

0 commit comments

Comments
 (0)