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