Re: CallableStatement and getUpdateCount

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: CallableStatement and getUpdateCount
Дата
Msg-id Pine.BSO.4.64.0804021158280.21649@leary.csoft.net
обсуждение исходный текст
Ответ на Re: CallableStatement and getUpdateCount  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Ответы Re: CallableStatement and getUpdateCount
Re: CallableStatement and getUpdateCount
Список pgsql-jdbc

On Wed, 2 Apr 2008, Albe Laurenz wrote:

> If I understood correctly then there *is* a result set in the case mentioned.
>
> Would it work as desired if the two checks in getUpdateCount were reversed?
>
>        if (result.getResultSet() != null)
>            return -1;
>
>        if (isFunction)
>            return 1;
>

Reading some more, the whole "if (isFunction)" line is bogus.  I was
thinking that the current situation was that all function calls returned
an update count of 1, but that's not true.  If you look at the code in
AbstractJdbc2Statement.executeWithFlags(int) you can see that if someone
has registered an output parameter (returnTypeSet), then it extracts the
results out of the underlying ResultSet and discards it (sets it to null).
So when getUpdateCount is called, the first result == null check is hit so
we return -1.

So right now the only case we're returning 1 is when we actually do have a
ResultSet which is exactly the opposite of what we want.  I've applied the
attached patch to CVS and backpatched to 8.0.

Kris Jurka

Вложения

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

Предыдущее
От: "Shavonne Marietta Wijesinghe"
Дата:
Сообщение: Re: JSP to PostgreSql
Следующее
От: Craig Ringer
Дата:
Сообщение: Hibernate / other ORM and pg_advisory_lock