Re: Synthesize support for Statement.getGeneratedKeys()? - Mailing list pgsql-jdbc

From Ken Johanson
Subject Re: Synthesize support for Statement.getGeneratedKeys()?
Date
Msg-id 45D53379.8070902@kensystem.com
Whole thread Raw
In response to Re: Synthesize support for Statement.getGeneratedKeys()?  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Kris Jurka wrote:
>
> The correct version check should be written:
> if (connection.haveMinimumServerVersion("8.2"))
>

I will correct this.

> I'm also not sure about the getGeneratedKeys method.  Should we throw an
> Exception instead of returning an empty ResultSet if there weren't any
> generated keys?

I checked and the spec says:
"If this Statement object did not generate any keys, an empty ResultSet
  object is returned."
If there is an implied rules elsewhere that it is not this simple, I
dont know. Otherwise it seems correct.

   Also do we need to do better tracking of what comes
> from generated keys vs just regular results?

I believe you are correct; if that method is called not-after
executeUpdate(String sql, ?), it should throw and exception.. or
something... the spec does not seem to elaborate on this.

   Once people start using
> this functionality we'll need some better error checking.

Agreed in full.



pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?
Next
From: Ken Johanson
Date:
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?