JDBC changes for 7.2... some questions...

From: Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: JDBC changes for 7.2... some questions...
Date: 2001-08-21 20:06:15
Message-ID: XFMail.20010821130615.ned.wolpert@knowledgenet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Folks-

I'm looking into some modifications for the Castor project on how we get
identies from inserted objects into the database. Specifically, if we have
used the SERIAL type to link in a sequence number during row insertion, it would
be great to get that sequence number when we do the insert. Both Oracle and
mssql have something to provide this. Getting the OID would be second-best
solution for us.

Now, I understand that in the Statement class, we have getInsertedOID() in the
table. However, the problem we run into is that this isn't accessiable if we
use something like poolman to provide database pooling of connections. (You
get the poolMan Statement object which is wraps the Statement classes of the
driver.)

So, what I'm looking for is some of the following ways to get the primary key
back, or the OID if nothing else...

1) Being able to use the RETURNING clause in prepared statements, like this
"INSERT INTO tableName (key1,...)
VALUES (value1,...)
RETURNING primKeyName INTO ?"
Which is what Oracle provides.

2) Working like Sybase and call "select @@OID" on the next call, which would
be trapped by the statment object to return a resultset with the oid of
the last inserted oid.

3) or, someother way that where one doesn't need direct access to method
calls to get 'getInsertedOID()', but indirect ones.

Thoughts?

Virtually,
Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>

D08C2F45: 28E7 56CB 58AC C622 5A51 3C42 8B2B 2739 D08C 2F45
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7gr83iysnOdCML0URAj+QAJ91RZXOoEA+xnu68YhIA4euNfIWOgCfcG1/
5L5ATkdL/wPwTnbQy0NI2jI=
=l/7B
-----END PGP SIGNATURE-----

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-08-21 20:23:09 Re: Link to bug webpage
Previous Message Andrew McMillan 2001-08-21 20:03:26 Re: [HACKERS] Postgresql log analyzer

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mihai Gheorghiu 2001-08-21 20:12:51 Data types
Previous Message Tom Lane 2001-08-21 19:27:55 Re: Couple of patches for jdbc driver