Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 17879
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: CLKAO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 1.44
Fixed in: 1.44



Subject: DBD::Pg::db do failed: ERROR: syntax error at or near "$1"
attached is a test case patch. This is a regression since 1.42.
Subject: dbd-pg-test.patch
=== t/12placeholders.t ================================================================== --- t/12placeholders.t (revision 52408) +++ t/12placeholders.t (local) @@ -8,7 +8,7 @@ $|=1; if (defined $ENV{DBI_DSN}) { - plan tests => 16; + plan tests => 18; } else { plan skip_all => 'Cannot run test unless DBI_DSN is defined. See the README file'; } @@ -62,6 +62,14 @@ ($retr) = $sth->fetchrow_array(); ok( (defined($retr) && $retr eq "\\'?:"), 'execute with ? placeholder'); + +$sql = "SELECT pname FROM dbd_pg_test WHERE pdate > now() - INTERVAL ?"; +$sth = $dbh->prepare($sql); +$sth->execute(3600) or die $dbh->error; + +($retr) = $sth->fetchrow_array(); +ok( (defined($retr) && $retr eq "\\'?:"), 'execute with ? placeholder'); + $sql = "SELECT pname FROM dbd_pg_test WHERE pname = :1"; $sth = $dbh->prepare($sql); $sth->bind_param(":1", "\\'?:"); @@ -117,5 +125,12 @@ $dbh->rollback(); +eval { +$dbh->do("UPDATE dbd_pg_test set pdate=now() WHERE pdate > now() - INTERVAL ?", + undef, 3600); +}; +diag $@ if $@; +ok(!$@, 'lives'); + ok( $dbh->disconnect(), 'Disconnect from database');