Re: Statement.executeQuery() and no results

Поиск
Список
Период
Сортировка
От Barry Lind
Тема Re: Statement.executeQuery() and no results
Дата
Msg-id 3F1E007B.9080506@xythos.com
обсуждение исходный текст
Ответ на Statement.executeQuery() and no results  (Sailesh Krishnamurthy <sailesh@cs.berkeley.edu>)
Список pgsql-jdbc
Sailesh,

Something else must be going on here.  As under normal circumstances you
will always get ResultSet even if the query returns now rows.  Can you
send test case that reproduces the problem?

thanks,
--Barry


Sailesh Krishnamurthy wrote:
> Folks
>
> When we run a query that produces no results, executeQuery() returns
> an exception instead of a ResultSet object for which the first call to
> next() returns false. (This is with a driver for pgsql 7.3.2)
>
> Here is some code in AbstractJdbc1Statement.java
>
>     /*
>      * A Prepared SQL query is executed and its ResultSet is returned
>      *
>      * @return a ResultSet that contains the data produced by the
>      *         *    query - never null
>      * @exception SQLException if a database access error occurs
>      */
>     public java.sql.ResultSet executeQuery() throws SQLException
>     {
>       this.execute(false);
>       while (result != null && !((AbstractJdbc1ResultSet)result).reallyResultSet())
>         result = ((AbstractJdbc1ResultSet)result).getNext();
>       if (result == null)
>         throw new PSQLException("postgresql.stat.noresult");
>       return result;
>     }
>
> Is my understanding correct ? Is this working as designed ? I'm not
> convinced that this is as per the spec. I would rather see a ResultSet
> object returned instead of an exception.
>



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Oliver Jowett
Дата:
Сообщение: Re: Statement.executeQuery() and no results
Следующее
От: Joe Conway
Дата:
Сообщение: Re: the IN clause saga