Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: rlucas [...] tercent.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.22
Fixed in: 1.32



Subject: Bind values rely on Perl's automatic numeric/string scalar conversion
Mac OS X 10.2, Perl 5.6.0, DBD::Pg 1.22, DBI 1.45 Bind values appear to rely upon Perl's automatic numeric/string scalar conversion in order to determine whether or not to quote. This bug was discussed on http://aspn.activestate.com/ASPN/Mail/Message/perl-DBI-dev/1607287 my $dbh = DBI->connect(...); #connect to Postgres; no errors with SQLite my $scalar = "abc"; warn "scalar is greater than zero (and now considered numeric)" if $scalar > 0; warn "dbh->quote(scalar) works ok: " . $dbh->quote($scalar); warn "but bind values do not:" . $dbh->selectrow_array( "SELECT 1 WHERE 1=?", undef, ($scalar) ); Using a numeric operator on the scalar makes Perl auto-convert it to a number; this is interpreted by the magic in Pg.xs as rendering the scalar ineligible for quoting. One solution is to bind those variables that must be text but might have been numberified with "$varname", thereby stringifying them in the eyes of Perl.
[guest - Tue Nov 2 09:33:27 2004]: Show quoted text
> Mac OS X 10.2, Perl 5.6.0, DBD::Pg 1.22, DBI 1.45 >
1.22 is quite old; 1.32 is the current version. Upgrade.