Skip site navigation (1) Skip section navigation (2)

Re: Here's a fix to AbstractJdbc3Statement.getGeneratedKeys

From: Jeppe Sommer <jso(at)trifork(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Here's a fix to AbstractJdbc3Statement.getGeneratedKeys
Date: 2009-04-24 08:19:34
Message-ID: 49F17616.9030801@trifork.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Sorry, I forgot to attach the patch :-(

Here it is.

Jeppe Sommer skrev:
> Frustrations over a 4 hour database script with MySQL forced me into 
> this :-)
>
> Porting a project from MySQL to PostgreSQL, I discovered that the jdbc3 
> facility of returning the generated keys from an insert statement does 
> not work. On a fresh cvs checkout, there is partial support, however, 
> all fields are returned, not only the field that are autogenerated.
>
> Here is a patch that fixes this. I hope someone will take a look, and 
> consider whether it can be adopted into the project. Or improved. It 
> works for me :-)
>
> The strategy of the patch is simply to inspect the metadata of the 
> returned (initially full) resultset, and then strip out any fields that 
> are not marked as autoincrement.
>
> BTW the 4 hour db script finishes after 2m 19s on PostgreSQL.
>
>
> Best Regards,
> Jeppe
>
>
>   


Attachment: pgjdbc.diff
Description: text/plain (3.9 KB)

In response to

pgsql-jdbc by date

Next:From: PeterDate: 2009-04-24 08:44:30
Subject: Re: JDBC problem with dates and ANYELEMENT type
Previous:From: Jeppe SommerDate: 2009-04-24 08:17:42
Subject: Here's a fix to AbstractJdbc3Statement.getGeneratedKeys

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group