Re: Multiple Statement result set problem with PreparedStatements

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Multiple Statement result set problem with PreparedStatements
Дата
Msg-id 42D5C801.4060006@opencloud.com
обсуждение исходный текст
Список pgsql-jdbc
Lenard, Rohan (Rohan) wrote:
> What I'm trying to do is do 2 inserts and get the resultant key values
> from the 2 inserts - i.e. effectively the row indexes (there are
> separate sequences for the pkey for each table, so the currval() gives
> the key of the insert for that table.
>
> This SQL works fine from any command line interface to the DB - giving
> the expected results.
>

> However through the JDBC driver, I don't get any results with a select
> involving the 2 seqs, but if I choose just one I do !!.

That is weird.

I will try to find time to put together a selfcontained testcase later
on (you could speed this up by sending me one :)

> BTW - The followup analysis below is flawed.
>
> With this SQL the driver always returns false for the execute() thus
> taking the getMoreResults() path & there are never results for the
> INSERT (at least not easily obtainable via the API in a generic way).

Sorry -- not thinking there :)

What I'd expect to see is this sequence:

  execute() returns false (no resultset for this result)
  getUpdateCount() returns 1 (1 row inserted)
  getMoreResults() returns false (no resultset for this result)
  getUpdateCount() returns 1 (1 row inserted)
  getMoreResults() returns true (resultset present)
  getResultSet() returns an appropriate resultset for the SELECT
  getMoreResults() returns false (no resultset for this result)
  getUpdateCount() returns -1 (no more results)

Your code seems to be expecting something different..

-O

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

Предыдущее
От: "Lenard, Rohan (Rohan)"
Дата:
Сообщение: Re: Multiple Statement result set problem with PreparedStatements ?
Следующее
От: "Lenard, Rohan (Rohan)"
Дата:
Сообщение: Re: Multiple Statement result set problem with PreparedStatements ?