pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marcus Andree S. Magalhaes <marcus.magalhaes@vlinfo.com.br>
To: henr-and@dsv.su.se
Cc: johnsw@wardbrook.com
Cc: pgsql-jdbc@postgresql.org
Subject: Re: getGeneratedKeys()
Date: Tue, 30 Dec 2003 21:28:21 -0200 (BRST)
Message-ID: <63735.200.174.148.100.1072826901.squirrel@webmail.webnow.com.br> (raw)
In-Reply-To: <33309.213.89.23.209.1072826327.squirrel@www.dsv.su.se>
References: <3FF1C0EE.4010107@dsv.su.se>
	<Pine.LNX.4.33.0312301523060.5331-100000@leary.csoft.net>
	<32899.213.89.23.209.1072821322.squirrel@www.dsv.su.se>
	<1216.192.168.0.64.1072824461.squirrel@mercury.wardbrook.com>
	<33309.213.89.23.209.1072826327.squirrel@www.dsv.su.se>


Guys,

I am too dumb or a simple currval() would be useful?
We solved this by sending two queries in JDBC. The first one inserts
a single record in the db. The other issues a currval on the desired
sequence.
There was a posting a few weeks ago, describing a clever method,
issuing both queries on the same connection by using the ";" operator
to separate the queries.
hope this helps.

>> Can you do the insert using a function instead, and return the currval
>> on the underlying sequence?
>>
>> John
>>
>
> I'm not sure what you mean. A stored procedure?
>
> The good thing about getGeneratedKeys() is that you don't have to write
> DB-specific code.
> --
> Henrik
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org






view thread (17+ messages)  latest in thread

Message-ID: <63735.200.174.148.100.1072826901.squirrel@webmail.webnow.com.br>
Permalink:  ../63735.200.174.148.100.1072826901.squirrel@webmail.webnow.com.br/
Also on:    postgresql.org/message-id/63735.200.174.148.100.1072826901.squirrel@webmail.webnow.com.br

 · 

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: marcus.magalhaes@vlinfo.com.br, henr-and@dsv.su.se, johnsw@wardbrook.com
  Subject: Re: getGeneratedKeys()
  In-Reply-To: <63735.200.174.148.100.1072826901.squirrel@webmail.webnow.com.br>
  References: <3FF1C0EE.4010107@dsv.su.se> <Pine.LNX.4.33.0312301523060.5331-100000@leary.csoft.net> <32899.213.89.23.209.1072821322.squirrel@www.dsv.su.se> <1216.192.168.0.64.1072824461.squirrel@mercury.wardbrook.com> <33309.213.89.23.209.1072826327.squirrel@www.dsv.su.se> <63735.200.174.148.100.1072826901.squirrel@webmail.webnow.com.br>

* 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