Returning oid or primary key

From: Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Returning oid or primary key
Date: 2001-05-02 16:43:31
Message-ID: 200105021643.f42GhVn05062@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Folks-

I've got an idea on a possible extension to the jdbc driver. I want
to submit a patch, but only if others think it makes sense. I want to
add a 'clause' that would slightly change the return value of the
executeUpdate(String) method in the Statment class. The goal is to
allow the return of the oid instead of the number of rows affected in
certain cases. For example:

insert into tablename(name) values('sample') returning oid

as the string would cause the returning value of the executeUpdate()
method to be the oid of inserted row (if successful) instead of the
count of updated rows.

I like the idea since I can now use standard pooling managers (like
PoolMan) and have access to the oid without having access to the
postgresql Statement class. Of course, the problem is that I'm now
'overloading' the returning value of the method, which is ugly. Also,
'faking' SQL syntax in the jdbc driver that doesn't exist in the
postgresql backend may also be problematic. Since callable statement
doesn't support returned values yet, I figure this would help.

What are people's thoughts about this?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: Public key at http://www.keyserver.net

iD8DBQE68DVqiysnOdCML0URAnN1AJ4jmgX3qpl28E9wt37ZMBhVObCrQACfc66M
yyGyEGWHW92futljJW85aW4=
=h600
-----END PGP SIGNATURE-----

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

D08C2F45: 28E7 56CB 58AC C622 5A51 3C42 8B2B 2739 D08C 2F45

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Esposito 2001-05-02 16:55:20 getScale() and getPrecision()
Previous Message Jerry Reid 2001-05-02 16:29:32 Unable to store SHA hash