[JDBC] Re: JDBC and the hstore ? operator - no longer working with build1211

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема [JDBC] Re: JDBC and the hstore ? operator - no longer working with build1211
Дата
Msg-id o9j3h7$ghu$1@blaine.gmane.org
обсуждение исходный текст
Ответ на Re: [JDBC] Re: JDBC and the hstore ? operator - no longer workingwith build 1211  (Mark Rotteveel <mark@lawinegevaar.nl>)
Список pgsql-jdbc
Mark Rotteveel schrieb am 02.03.2017 um 19:10:
>>    connection.prepareStatement("select * from foo where hstore_column ?& array['key']");
>>    connection.prepareStatement("select * from foo where hstore_column ?| array['key']");
>>
>> The prepareStatement() call succeeds, but when calling executeQuery()
>> an exception is thrown:
>>
>>    org.postgresql.util.PSQLException: No value specified for parameter 1.
>>
>> The goal is to pass the array as a parameter, something like:
>>
>>    Array keys = con.createArrayOf("text", new String[] {"key1","key2"});
>>    connection.prepareStatement("select * from foo where hstore_column ?& ?");
>>    pstmt.setArray(1, keys);
>>    ResultSet rs = pstmt.executeQuery();
>>
>> Tested with 1212 and 42.0.0
>
> I haven't tried it, but would you logically need to use ??& and ??|, if the ? operator is escaped using ??

That indeed does work.

We first tried it with an obfuscation layer (aka "ORM") which seems to mess around with those operators and breaks that
escaping.

Thomas



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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: Problem updating driver to 42.0.0
Следующее
От: Bogdan Daniliuc
Дата:
Сообщение: Re: Problem updating driver to 42.0.0