Re: Array paramiters

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Re: Array paramiters
Дата
Msg-id 200706050938.58019.andreak@officenet.no
обсуждение исходный текст
Ответ на Array paramiters  ("ben sagal" <BSagal+pgsql@gmail.com>)
Ответы Re: Array paramiters  ("ben sagal" <bsagal@gmail.com>)
Список pgsql-jdbc
On Monday 04 June 2007 15:29:32 ben sagal wrote:
> I would like to query data based on the values in a java int array ( int[]
> ), using a prepared statement similar to:
>
> "SELECT * FROM items WHERE id IN (?)"
>
> can anybody advise in have to set the prepared in the statement?

You must generate the query manually, by iterating over your array and add '?'
for each element. Then you need to pass each value of the array to
setInt(index, array[i]);

--
Andreas Joseph Krogh <andreak@officenet.no>
Senior Software Developer / Manager
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Karenslyst Allé 11      | know how to do a thing and to watch         |
PO. Box 529 Skøyen      | somebody else doing it wrong, without       |
0214 Oslo               | comment.                                    |
NORWAY                  |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: PostgreSQL JDBC support for runtime configuration options
Следующее
От: "Raghavendra MB"
Дата:
Сообщение: Connection Pool