DBI question: binding params in HAVING clauses

Andy Armstrong andy at hexten.net
Thu Jan 26 15:16:04 GMT 2006


On 26 Jan 2006, at 15:01, Jeff Anderson wrote:
> Like so?
>
> my $sql = sprintf('
>      SELECT COUNT(actors.name), countries.name
>        FROM actorsXcountries, countries, actors
>       WHERE actors.id = actorsXcountries.actorid AND
>             countries.id = actorsXcountries.countryid
>    GROUP BY countries.name
>      HAVING COUNT(actors.name) < %d
>    ORDER BY COUNT(actors.name)
> ', $dbh->quote(3));

What's the point of $dbh->quote() when %d can only expand to an  
integer anyway? Or rather what's the point of using sprintf()?

-- 
Andy Armstrong, hexten.net



More information about the london.pm mailing list