Subject: | bind variables are not bound to placeholders in the correct order |
Date: | Tue, 07 Oct 2014 17:15:14 +0200 |
To: | bug-DBD-CSV [...] rt.cpan.org |
From: | vulpeculus [...] gmx.de |
It seems that bind variables are not bound in the correct order to the
placeholders in a 'where'-clause of a SQL statement, if some parts of the clause
need not to be executed (e.g. OR after a true condition).
The attached program demonstrates the problem:
Assume a csv databasea (called abc.csv) with one row A=1, B=2, C=3:
A,B,C
1,2,3
The search for (A=1 OR B=1) AND C=3 should return the only row in abc.csv, but
returns nothing
prepare('select * from abc where (a=? or b=?) and c=?')
execute(1,1,3)
The search for (A=1 OR B=3) AND C=99 should return no result, but returns the
one row in abc.csv
same prepare as befor
execute(1,3,99)
Tested on Ubuntu (Linux xxx 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux)
and Solaris (SunOS xxx 5.10 Generic_150401-15 i86pc i386 i86pc),
with perl 5.18.2 and 5.10.0
and
use DBI 1.631;
use DBD::CSV 0.44;
use SQL::Statement 1.405;
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.