Re: JDBC and fetching the OID of an insert

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: JDBC and fetching the OID of an insert
Дата
Msg-id 1032357854.26938.64.camel@inspiron.cramers
обсуждение исходный текст
Ответ на JDBC and fetching the OID of an insert  ("Michael Paesold" <mpaesold@gmx.at>)
Список pgsql-jdbc
There is or was actually a method in the driver ResultSet.getLastOID
which allowed you to do this.You will have to cast the resultset into a
AbstractJdbc(x)ResultSet, where x is the version; but Daryl's way is
much better since oid's can wrap, and there is a possiblity that they
don't exist ( you can turn them off in postgres).

Dave

On Wed, 2002-09-18 at 09:36, Michael Paesold wrote:
> Hi,
>
> Does anyone of you know, how to get the OID of the just inserted Row after
> stmt.executeUpdate("INSERT... ")? I hope this is possible at all!
>
> If it's not, I would be willing to implement getGeneratedKeys() to return at
> least the OID of an insert. Assuming that would be possible and exceptable?
>
> (Btw. am I correct that the only way to get a value for a sequence via JDBC
> is to "SELECT currval('...')" resp. "SELECT nextval('...')"?)
>
>
> Best Regards,
> Michael
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Daryl Beattie
Дата:
Сообщение: Re: JDBC and fetching the OID of an insert
Следующее
От: "Michael Paesold"
Дата:
Сообщение: Re: JDBC and fetching the OID of an insert