Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: mhoram [...] gmx.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 2.19.0



Subject: Inconsistent behaviour with Dollar-quoted String Constants
Date: Sun, 08 Jan 2012 22:58:09 +0100
To: bug-dbd-pg [...] rt.cpan.org
From: mhoram [...] gmx.de
David Wheeler asked me to forward this bug. See for reference and his response: http://www.nntp.perl.org/group/perl.dbd.pg/2012/01/msg641.html I am using UTF-8 characters within Dollar-quoted tags. Following code is the problem-setting. Show quoted text
--- CODE BEGIN --- #!/usr/bin/perl use strict; use DBI; my $db = DBI->connect( "dbi:Pg:dbname=$PgDbName;host=$PgHost;port=$PgPort", $PgSqlUser, $PgSqlPass); my $txt = '2'; my $delim = "\$\x{5317}\$"; my $sql = "SELECT $delim$txt$delim"; print "SQL = '$sql'\n"; $db->do($sql); print "after do\n"; $db->selectrow_hashref($sql); print "after_selectrow_hashref\n";
--- CODE END --- The script dies during selectrow_hashref and the output of the script is
--- OUTPUT BEGIN --- SQL = 'SELECT $北$2$北$' after do Invalid placeholders: must start at $1 and increment one at a time (expected: $1) --- OUTPUT END --- It seems like $2 is interpreted as placeholder before the evaluation of Dollar-quoting, but only in $db->selectrow_hashref(). The inconsistent part is that $db->do() works just fine. Regards, Markus
Andrew Dunstan adds: Show quoted text
> Any non-ASCII character qualifies. From scan.l: > > dolq_start [A-Za-z\200-\377_] > dolq_cont [A-Za-z\200-\377_0-9] > dolqdelim \$({dolq_start}{dolq_cont}*)?\$
Might be helpful in tweaking the DBD::Pg parser. David