Re: Getting a ResultSet for a refcursor element. - Mailing list pgsql-jdbc

From Nic Ferrier
Subject Re: Getting a ResultSet for a refcursor element.
Date
Msg-id 87r8ez2zit.fsf@pooh-sticks-bridge.tapsellferrier.co.uk
Whole thread Raw
In response to Re: Getting a ResultSet for a refcursor element.  (Barry Lind <barry@xythos.com>)
Responses Re: Getting a ResultSet for a refcursor element.
List pgsql-jdbc
Barry Lind <barry@xythos.com> writes:


> The other reason I don't like returning a result set directly from
> getObject is that it doesn't seem to follow the same pattern as all the
> other objects that are being returned.  You are losing the distinction
> that the refcursor is a pointer to a result set, not the actual result
> set itself.
>
> Finally, does anyone know how other databases' jdbc drivers deal with
> this type of functionality?  I would rather try to follow an existing
> example of how someone else has done this then to go it alone and build
> our own mechanism.  Since I know Oracle has refcursors, how does oracle
> expose them through jdbc?

Like I've done it for pgsql.

Ordinarily one register's the out parameter of the proc you are calling
with the Oracle ResultSet implementation class.



> I think a better approach
> would be to return a pg specific object (lets call it PGrefcursor).  The
> object would have at least the following two methods: getRefCursorName()
> and getResultSet().  The reason I think this is a better approach is
> then you can turn around and use the PGrefcursor object on a setObject()
> call to bind the refcursor to a different function call.  So you can
> have a function that returns a refcursor and another that takes a
> refcursor and you can get the refcursor object from one call and pass it
> onto the other.

Of course, that's a good approach too... but doesn't getting the
ResultSet directly makes it clear(er) that the new ResultSet is part
of the same transaction.



Nic

pgsql-jdbc by date:

Previous
From: Barry Lind
Date:
Subject: Re: Getting a ResultSet for a refcursor element.
Next
From: Nic Ferrier
Date:
Subject: Re: Getting a ResultSet for a refcursor element.