| From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> | 
|---|---|
| To: | "Kris Jurka *EXTERN*" <books(at)ejurka(dot)com> | 
| Cc: | "Sam Lawrence *EXTERN*" <sam(at)fsbtech(dot)com>, <pgsql-jdbc(at)postgresql(dot)org> | 
| Subject: | Re: CallableStatement and getUpdateCount | 
| Date: | 2008-04-02 08:25:30 | 
| Message-ID: | D960CB61B694CF459DCFB4B0128514C201F3E94E@exadv11.host.magwien.gv.at | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-jdbc | 
Kris Jurka wrote:
> > Hmmm. getUpdateCount() is defined in
> > org/postgresql/jdbc2/AbstractJdbc2Statement.java as
> >
> >        if (isFunction)
> >            return 1;
> 
> I would guess that this code was conceived without regard to returning 
> sets.  For code that does {? = call f()} you expect the caller to fetch 
> the result using CallableStatement.getXXX() so that's why the code isn't 
> indicating that a ResultSet is returned even though there is one under the 
> hood.  The JDBC driver has no idea whether the function it's calling is 
> returning a SETOF or not, so it can't use that to determine what to return 
> for getUpdateCount.
> 
> Perhaps we can differentiate between calls of the form {call f()} and {? = 
> call f()} ?
If I understood correctly then there *is* a result set in the case mentioned.
Would it work as desired if the two checks in getUpdateCount were reversed?
        if (result.getResultSet() != null)
            return -1;
        if (isFunction)
            return 1;
Or is there a problem I do not see?
Yours,
Laurenz Albe
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shavonne Marietta Wijesinghe | 2008-04-02 09:40:35 | Re: JSP to PostgreSql | 
| Previous Message | Guillaume Smet | 2008-04-02 01:04:04 | Re: Re: [HACKERS] How embarrassing: optimization of a one-shot query doesn't work |