Re: Multiple Statement result set problem with PreparedStatements ?

From: "Lenard, Rohan (Rohan)" <rlenard(at)avaya(dot)com>
To: "Oliver Jowett" <oliver(at)opencloud(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Multiple Statement result set problem with PreparedStatements ?
Date: 2005-07-14 02:05:36
Message-ID: 2773CAC687FD5F4689F526998C7E4E5F1EF340@au3010avexu1.global.avaya.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I have one but it relies on particular tables existing - if I get a few
minutes I too will simplify it to cause it ..

Rohan
| -----Original Message-----
| From: Oliver Jowett [mailto:oliver(at)opencloud(dot)com]
| Sent: Thursday, July 14, 2005 12:04 PM
| To: Lenard, Rohan (Rohan)
| Cc: pgsql-jdbc(at)postgresql(dot)org
| Subject: Re: [JDBC] Multiple Statement result set problem
| with PreparedStatements ?
|
| 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
|

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2005-07-14 02:19:53 Re: Multiple Statement result set problem with PreparedStatements
Previous Message Oliver Jowett 2005-07-14 02:03:45 Re: Multiple Statement result set problem with PreparedStatements