From: Oliver Jowett <oliver@opencloud.com>
To: Lenard, Rohan (Rohan) <rlenard@avaya.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Multiple Statement result set problem with PreparedStatements
Date: Thu, 14 Jul 2005 14:03:45 +1200
Message-ID: <42D5C801.4060006@opencloud.com> (raw)
In-Reply-To: <2773CAC687FD5F4689F526998C7E4E5F1EF323@au3010avexu1.global.avaya.com>
References: <2773CAC687FD5F4689F526998C7E4E5F1EF323@au3010avexu1.global.avaya.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, rlenard@avaya.com
Subject: Re: Multiple Statement result set problem with PreparedStatements
In-Reply-To: <42D5C801.4060006@opencloud.com>
References: <2773CAC687FD5F4689F526998C7E4E5F1EF323@au3010avexu1.global.avaya.com> <42D5C801.4060006@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox