From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: DELETE ... RETURNING |
Date: | 2009-07-14 06:28:39 |
Message-ID: | h3h8im$vmi$1@ger.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ken Johanson | 2009-07-14 06:42:53 | An eta for ResultSetMetaData getTableName, getSchemaName, getCatalogName? |
Previous Message | Oliver Jowett | 2009-07-13 22:35:31 | Re: DELETE ... RETURNING |