pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: DELETE ... RETURNING
Date: Tue, 14 Jul 2009 08:28:39 +0200
Message-ID: <h3h8im$vmi$1@ger.gmane.org> (raw)
In-Reply-To: <4A5BB6B3.3020002@opencloud.com>
References: <h3g2rn$dn8$1@ger.gmane.org>
	<226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.com>
	<h3g536$kq4$1@ger.gmane.org>
	<4A5BAA29.9000004@opencloud.com>
	<h3gafc$51d$1@ger.gmane.org>
	<4A5BB6B3.3020002@opencloud.com>

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




view thread (10+ messages)  latest in thread

Message-ID: <h3h8im$vmi$1@ger.gmane.org>
Permalink:  ../h3h8im$vmi$1@ger.gmane.org/
Also on:    postgresql.org/message-id/h3h8im$vmi$1@ger.gmane.org

 · 

reply

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: spam_eater@gmx.net
  Subject: Re: DELETE ... RETURNING
  In-Reply-To: <h3h8im$vmi$1@ger.gmane.org>
  References: <h3g2rn$dn8$1@ger.gmane.org> <226a19190907131251m6c3786f5id8e8025f5c53cf66@mail.gmail.com> <h3g536$kq4$1@ger.gmane.org> <4A5BAA29.9000004@opencloud.com> <h3gafc$51d$1@ger.gmane.org> <4A5BB6B3.3020002@opencloud.com> <h3h8im$vmi$1@ger.gmane.org>

* 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