"ben sagal" <bsagal@gmail.com> writes:
> I would ideally like to use a prepared statement, in which i can on each
> execution insert a different array? the method u suggest will not allow use
> of a prepared statement.
The alternative is building up a string form of an array of your list of
parameters and passing it as a single parameter.
Something like
$sth = $dbh->prepare("select * from foo where bar =ANY(?::int[])")
$sth->execute('{' . join(@array, ',') . '}');
This works better with something like integers for which you don't have to
worry about escaping. The method the other poster suggested would be lower
overhead I think but this only gives you one prepared query if you have a wide
variety of lengths of lists.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com