Re: Getting a ResultSet for a refcursor element.

From: Nic Ferrier <nferrier(at)tapsellferrier(dot)co(dot)uk>
To: Barry Lind <barry(at)xythos(dot)com>
Cc: Dave Cramer <Dave(at)micro-automation(dot)net>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Getting a ResultSet for a refcursor element.
Date: 2002-10-09 19:16:58
Message-ID: 87r8ez2zit.fsf@pooh-sticks-bridge.tapsellferrier.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Barry Lind <barry(at)xythos(dot)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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Nic Ferrier 2002-10-09 21:56:07 Re: Getting a ResultSet for a refcursor element.
Previous Message Barry Lind 2002-10-09 18:24:03 Re: Getting a ResultSet for a refcursor element.