createArrayOf("bytea", Array) problem

Поиск
Список
Период
Сортировка
От Daniel Selinger
Тема createArrayOf("bytea", Array) problem
Дата
Msg-id 52FDFA8A.8040707@focusmr.com
обсуждение исходный текст
Список pgsql-jdbc
Hi all,

I have a problem with submitting arrays of bytea to the database via
native jdbc arrays.

i'm trying to do the following:

List<byte[]> hashes = new ArrayList<>();
//add some SHA256 in form of byte[]
srcPst = srcConnection.prepareStatement("select array_dims(?)");
srcPst.setArray(1, srcConnection.createArrayOf("bytea", hashes.toArray()));
srcRs = srcPst.executeQuery();
srcRs.next();
srcRs.getString(1);

--> "[1:5][1:32]"


if i do the same thing on the database:

select array_dims(array_agg(hashcolumn)) from hashtable; (hashcolumn is
of type bytea(32))

--> "[1:5]"


now im struggling how to use the bound data from jdbc on the database,
because when i use the "[1:5][1:32]" array on the database for something
like

select * from hashtable where hashcolumn = ANY(?), i get no results,
although i retrieved the hashes from a resultset on exaclty this table
with getBytes("hashcolumn")


any suggestions or hints on what i might doing wrong?







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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Time for a new release?
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Time for a new release?