Thread: getLastUID() In pgsql JDBC

getLastUID() In pgsql JDBC

From
Hunter Hillegas
Date:
Does this method exist in any of the pgsql JDBC drivers?

We're testing out some auto-increment stuff for EJBs in JBoss and looking
for the correct method...

Also, is there a page or doc that details what is and isn't implemented in
the pg jdbc driver?

Thanks,
Hunter


Re: getLastUID() In pgsql JDBC

From
Dave Cramer
Date:
Ya,

select curval('sequence')

will return the current value, and it is connection specific, in other
words if another connection increments it before you get the value you
will get your value.

Dave

On Wed, 2003-05-07 at 21:20, Hunter Hillegas wrote:
> Does this method exist in any of the pgsql JDBC drivers?
>
> We're testing out some auto-increment stuff for EJBs in JBoss and looking
> for the correct method...
>
> Also, is there a page or doc that details what is and isn't implemented in
> the pg jdbc driver?
>
> Thanks,
> Hunter
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
--
Dave Cramer <Dave@micro-automation.net>


Re: getLastUID() In pgsql JDBC

From
Hunter Hillegas
Date:
Hmmm... Yes, I am familiar with that SQL...

I misspoke... I am looking for getLastOID()... What class is that a part of?
Is there JavaDoc for the driver's classes?

Thanks again,
Hunter

> From: Dave Cramer <Dave@micro-automation.net>
> Date: 07 May 2003 21:49:45 -0400
> To: Hunter Hillegas <lists@lastonepicked.com>
> Cc: Postgre JDBC List <pgsql-jdbc@postgresql.org>
> Subject: Re: [JDBC] getLastUID() In pgsql JDBC
>
> Ya,
>
> select curval('sequence')
>
> will return the current value, and it is connection specific, in other
> words if another connection increments it before you get the value you
> will get your value.
>
> Dave
>
> On Wed, 2003-05-07 at 21:20, Hunter Hillegas wrote:
>> Does this method exist in any of the pgsql JDBC drivers?
>>
>> We're testing out some auto-increment stuff for EJBs in JBoss and looking
>> for the correct method...
>>
>> Also, is there a page or doc that details what is and isn't implemented in
>> the pg jdbc driver?
>>
>> Thanks,
>> Hunter
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 3: if posting/reading through Usenet, please send an appropriate
>> subscribe-nomail command to majordomo@postgresql.org so that your
>> message can get through to the mailing list cleanly
> --
> Dave Cramer <Dave@micro-automation.net>


Re: getLastUID() In pgsql JDBC

From
Dave Cramer
Date:
No, there's no javadoc for the code, but to answer your other question
it is in org.postgresql.PGStatement, just cast your statement object to
that, and call the getLastOID()

package org.postgresql;


import java.sql.*;

/* $Header:
/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/PGStatement.java,v 1.6 2002/09/08 00:15:28 barry Exp $
 * This interface defines PostgreSQL extentions to the
java.sql.Statement interface.
 * Any java.sql.Statement object returned by the driver will also
implement this
 * interface
 */
public interface PGStatement
{

    /*
     * Returns the Last inserted/updated oid.
     * @return OID of last insert
            * @since 7.3
     */
    public long getLastOID() throws SQLException;

    public void setUseServerPrepare(boolean flag) throws SQLException;

    public boolean isUseServerPrepare();

}

Dave
On Wed, 2003-05-07 at 22:02, Hunter Hillegas wrote:
> Hmmm... Yes, I am familiar with that SQL...
>
> I misspoke... I am looking for getLastOID()... What class is that a part of?
> Is there JavaDoc for the driver's classes?
>
> Thanks again,
> Hunter
>
> > From: Dave Cramer <Dave@micro-automation.net>
> > Date: 07 May 2003 21:49:45 -0400
> > To: Hunter Hillegas <lists@lastonepicked.com>
> > Cc: Postgre JDBC List <pgsql-jdbc@postgresql.org>
> > Subject: Re: [JDBC] getLastUID() In pgsql JDBC
> >
> > Ya,
> >
> > select curval('sequence')
> >
> > will return the current value, and it is connection specific, in other
> > words if another connection increments it before you get the value you
> > will get your value.
> >
> > Dave
> >
> > On Wed, 2003-05-07 at 21:20, Hunter Hillegas wrote:
> >> Does this method exist in any of the pgsql JDBC drivers?
> >>
> >> We're testing out some auto-increment stuff for EJBs in JBoss and looking
> >> for the correct method...
> >>
> >> Also, is there a page or doc that details what is and isn't implemented in
> >> the pg jdbc driver?
> >>
> >> Thanks,
> >> Hunter
> >>
> >>
> >> ---------------------------(end of broadcast)---------------------------
> >> TIP 3: if posting/reading through Usenet, please send an appropriate
> >> subscribe-nomail command to majordomo@postgresql.org so that your
> >> message can get through to the mailing list cleanly
> > --
> > Dave Cramer <Dave@micro-automation.net>
--
Dave Cramer <Dave@micro-automation.net>