|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: sql, dbi, placeholders and 'in'
|
Gay, Jerry wrote:
is there a module that will help me create these queries on the fly, or am i
stuck with concatenating the bits together like
my $sql= 'select fields from table where '
. 'product in (' . join( ', ' => ( ('?')x@products) ) . ')'
. 'document in (' . join( ', ' => ( ('?')x@documents) ) . ')'
;
IIRC, you can just do this:
my $sth = $dbh->prepare(<<'');
SELECT fields
FROM table
WHERE product IN (?)
AND document IN (?)
then map the bind values into a single string like this:
q{'a','b','c'}
and execute as normal.
Phil
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
|
|