Re: Possible regression: setNull() usage changed from 7.4

Поиск
Список
Период
Сортировка
От Markus Schaber
Тема Re: Possible regression: setNull() usage changed from 7.4
Дата
Msg-id 443FC08F.8020505@logix-tt.com
обсуждение исходный текст
Ответ на Re: Possible regression: setNull() usage changed from 7.4 to  (Jeff Hubbach <jeff.hubbach@chha.com>)
Список pgsql-jdbc
Hi, Jeff,

Jeff Hubbach wrote:

>   select count(*) from users where usernam = ? and
>   (?::integer is null or userid != ?)
>
>   stmt.setString(1,'blah');
>   stmt.setNull(2,java.sql.Types.NULL);
>   stmt.setNull(3,java.sql.Types.NULL);
>
> This code gives the server the type information it needs by doing an
> explicit cast. It seems to work, but was wondering if there are any
> problems you see with it (or if you have a better/cleaner way to go
> about it).

The correct way, IMHO, would be to use two different prepared
statements, one with the userid, and another one without.

HTH,
Markus

--
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org

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

Предыдущее
От: Jeff Hubbach
Дата:
Сообщение: Re: Possible regression: setNull() usage changed from 7.4 to
Следующее
От: David Goodenough
Дата:
Сообщение: What is the number equivalient of LIMIT ALL