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.
In response to
pgsql-jdbc by date
|Next:||From: Ken Johanson||Date: 2009-07-14 06:42:53|
|Subject: An eta for ResultSetMetaData getTableName, getSchemaName, getCatalogName?|
|Previous:||From: Oliver Jowett||Date: 2009-07-13 22:35:31|
|Subject: Re: DELETE ... RETURNING|