Re: DELETE ... RETURNING

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: DELETE ... RETURNING
Дата
Msg-id h3g536$kq4$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: DELETE ... RETURNING  (Dennis Brakhane <brakhane@googlemail.com>)
Ответы Re: DELETE ... RETURNING
Список pgsql-jdbc
Dennis Brakhane wrote on 13.07.2009 21:51:
>> Am I missing something or is the "RETURNING" feature not supported by the
>> driver?
>
> executeUpdate by definitionem can only return an int, the number of
> rows affected.

True, but the JDBC API also defines Statement.getMoreResults() and
Statement.getResultSet() which could be used to return that information

At least executeUpdate() should not throw an exception.

> You probably can use stmt.executeQuery instead

Actually execute() works without throwing an exception, but getMoreResults() and
getResultSet() do not return the information about the deleted rows.

Additionally when using execute(), getUpdateCount() will return -1 even if rows
were deleted.

Thomas


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

Предыдущее
От: Dennis Brakhane
Дата:
Сообщение: Re: DELETE ... RETURNING
Следующее
От: David Rees
Дата:
Сообщение: Re: Java long