SQL::Statement bug
From: Christopher Huhn (C.Huhn_at_gsi.de)
Date: 04/16/04
- Next message: Tim To: "performance problem with dbd oracle"
- Previous message: E: "Re: script into database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Apr 2004 02:38:22 -0700
Hi,
I get the following error when I try to make sql lookups in
amavisd-new work with DBD::CSV.
amavis is preparing a bunch of statements with "WHERE column IN
(?,?,...)" clauses.
This code is working correctly:
$sql = 'SELECT * FROM whitelist WHERE user_id = ? '.
'AND from_address IN (?,?)';
$sth = $dbh->prepare($sql) or die "Cannot prepare: " .
$dbh->errstr();
$sth->bind_param(1, '1001');
$sth->bind_param(2, 'email1@other-domain.tld');
$sth->bind_param(3, 'email2@third-domain.tld');
$sth->execute() or die "Cannot execute: " . $sth->errstr();
DBI::dump_results($sth);
while this code (with just one ? more)
$sql = 'SELECT wb,from_address FROM whitelist WHERE user_id = ? '.
'AND from_address IN (?,?,?)';
$sth = $dbh->prepare($sql) or die "Cannot prepare: " .
$dbh->errstr();
$sth->bind_param(1, '1001');
$sth->bind_param(2, 'email1@other-domain.tld');
$sth->bind_param(3, 'email2@third-domain.tld');
$sth->bind_param(4, 'email3@domain4.tld');
$sth->execute() or die "Cannot execute: " . $sth->errstr();
DBI::dump_results($sth);
leads to
Use of uninitialized value in substitution iterator at
/usr/share/perl5/SQL/Parser.pm line 974.
SQL ERROR: Bad predicate: ''!
Use of uninitialized value in string eq at
/usr/share/perl5/SQL/Statement.pm line 1000, <GEN5> line 2.
Use of uninitialized value in string eq at
/usr/share/perl5/SQL/Statement.pm line 1000, <GEN5> line 2.
...
Use of uninitialized value in string eq at
/usr/share/perl5/SQL/Statement.pm line 1107, <GEN5> line 4.
Use of uninitialized value in string eq at
/usr/share/perl5/SQL/Statement.pm line 1108, <GEN5> line 4.
and finally
'W', 'email1@other-domain.tld'
1 rows
Adding even more ? leads to the same results.
Note that "SELECT wb,from_address FROM whitelist WHERE from_address IN
(?,?,?)" is working correctly so it seems to be realted to the
conjunction in the WHERE clause.
This is the contents of corresponding CSV file:
FROM_ADDRESS;USER_ID;WB
email1@other-domain.tld;1001;W
email2@third-domain.tld;1001;W
email3@domain4.tld;1001;W
This is my version info (Debian woody):
# dpkg -l libdbd-csv-perl libsql-statement-perl perl
ii libdbd-csv-perl 0.2002-1 perl DBD::CSV
- DBI driver for CSV files
ii libsql-statement-perl 1.005-1 SQL parsing
and processing engine
ii perl 5.6.1-8.6 Larry Wall's
Practical Extraction and Report Language.
Regards,
Christopher Huhn
- Next message: Tim To: "performance problem with dbd oracle"
- Previous message: E: "Re: script into database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|