Re: Array paramiters
От | Gregory Stark |
---|---|
Тема | Re: Array paramiters |
Дата | |
Msg-id | 87abvect7h.fsf@oxford.xeocode.com обсуждение исходный текст |
Ответ на | Re: Array paramiters ("ben sagal" <bsagal@gmail.com>) |
Список | pgsql-jdbc |
"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
В списке pgsql-jdbc по дате отправления: