Re: DELETE ... RETURNING - Mailing list pgsql-jdbc

From Thomas Kellerer
Subject Re: DELETE ... RETURNING
Date
Msg-id h3h8im$vmi$1@ger.gmane.org
Whole thread Raw
In response to Re: DELETE ... RETURNING  (Oliver Jowett <oliver@opencloud.com>)
List 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 by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: DELETE ... RETURNING
Next
From: Ken Johanson
Date:
Subject: An eta for ResultSetMetaData getTableName, getSchemaName, getCatalogName?