Re: DELETE ... RETURNING

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: DELETE ... RETURNING
Дата
Msg-id h3h8im$vmi$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: DELETE ... RETURNING  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
Oliver Jowett, 14.07.2009 00:35:
> I took another look at this, and your code assumes that the update count
> is the first result. It's not. In the case where both a resultset and an
> update count are present in a single query, the driver puts the
> resultset result first (so that executeQuery() works nicely).
>
> So your first call to getUpdateCount() returns -1 because the current
> result is a resultset, not an update count (see the javadoc). Then you
> call getMoreResults() which moves to the 2nd result (the update count)
> and returns false because there's no resultset (again, see the javadoc).
>
> If you want a general-purpose result processing loop

The perils of quick and dirty test programs...

I actually have that generic loop already, just failed to think it through completely before posting ;)

Sorry for the trouble and thanks for the help.

Regards
Thomas

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: DELETE ... RETURNING
Следующее
От: Ken Johanson
Дата:
Сообщение: An eta for ResultSetMetaData getTableName, getSchemaName, getCatalogName?