Subject: | Using placeholder in update statement causes error |
The following script fails, describing the error with:
DBD::CSV::st execute failed: Can't use an undefined value as an ARRAY
reference at C:/Programme/perl/site/lib/SQL/Statement.pm line 1772,
<GEN0> line 2. [for Statement "update agents set id = id + ?"] at
update.pl line 12.
Cannot execute: Can't use an undefined value as an ARRAY reference at
C:/Programme/perl/site/lib/SQL/Statement.pm line 1772, <GEN0> line 2.
No error occurs when executing the same update statement with DBD-ODBC
and a PostgreSQL database.
Script:
use strict;
use DBI;
my ($dbh, $sth, $prm);
$prm = 5;
$dbh = DBI->connect(qq{DBI:CSV:csv_sep_char=\\;;csv_eol=\n});
$dbh->{'csv_tables'}->{'agents'} = { 'file' => 'agents.csv'};
$sth = $dbh->prepare("update agents set id = id + ?");
$sth->execute($prm) or die "Cannot execute: " . $sth->errstr();
$sth->finish();
$dbh->disconnect();
CSV-File:
id;agent_name
1;hetzner2
2;hetzner3
3;strato5
Environment:
OS: Windows 2000 SP4
Perl: v5.8.7 built for MSWin32-x86-multi-thread
DBD-CSV: 0.22
SQL-Statement: 1.14
DBI: 1.49