Re: Problem with executeBatch and "A result was returned when none was expected"

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Problem with executeBatch and "A result was returned when none was expected"
Дата
Msg-id AANLkTimWSO4QG7+n9eyXgbNx6-jETXJp2TC66-gFXE8F@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Problem with executeBatch and "A result was returned when none was expected"  (Lew <noone@lewscanon.com>)
Список pgsql-jdbc
On 19 March 2011 11:47, Lew <noone@lewscanon.com> wrote:
> Oliver Jowett wrote:

> This is the documented result when a statement tries to create a result set:
> "Throws BatchUpdateException (a subclass of SQLException) if one of the
> commands sent to the database fails to execute properly or attempts to
> return a result set."

However, the query that the app provided was just a simple INSERT,
which does not return a result set, so this isn't really relevant
here. If the driver decides to transform the query, it's also
responsible for cleaning the mess up afterwards!

>> You are correct, generated keys don't work with executeBatch() yet.
>> (There was another thread about this a couple of days ago)
>
> How would you retrieve the result if 'executeBatch()' did what you're
> asking?

Via getGeneratedKeys(). The driver already knows that it added the
RETURNING clause to implement Statement.RETURN_GENERATED_KEYS, and it
deals with the eventual resultset in the simple query execution path
(so that it looks to the caller as if the original query executed with
no RETURNING clause). The missing piece is equivalent code for the
batch execution path.

Oliver

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

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Problem with executeBatch and "A result was returned when none was expected"
Следующее
От: Sean Bowman
Дата:
Сообщение: Re: Problem with executeBatch and "A result was returned when none was expected"