Question about refcursors

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Question about refcursors
Date: 2007-10-26 22:55:35
Message-ID: fftr98$uhk$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,

I'm trying to add support for refcursors in my JDBC tool and while trying out
the examples in the docs
(<http://jdbc.postgresql.org/documentation/82/callproc.html#callproc-resultset>)

I stumbled over something where I'm not sure whether this is intended or simply
something which was never thought of.

My generic code to call the procedure does basically a prepareCall() (but not
with the "? =" as I cannot distinguish between a function and a procedure at
that moment. And it seems to be working.

Now after running the procedure (using execute()) I'm (generically) calling
getResultSet() on the statement object. And indeed the driver does return a
ResultSet, but it seems that the actual result of the call is "hidden" inside
one of the columns of the resultset. If I do a getObject() on that resultset I
get another result set which indeed is the result of my SELECT in the procedure.

My question: is there a reason why the "real" result cannot be obtained using
getResultSet() but is wrapped into another ResultSet?

I can check the database to find out if a function or a procedure is called, but
it would be really cool, if the driver could handle that for me.

I am aware that I'm not using the calls 100% according to the API and the
documentation, but still :)

Cheers
Thomas

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-10-26 23:20:22 Re: Question about refcursors
Previous Message Marek Lewczuk 2007-10-26 18:08:17 Re: AbstractJdbc2Array - another patch