From: "Karl Goldstein" <karlgold(at)yahoo(dot)com>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject:
Date: 2002-11-04 17:05:52
Message-ID: 00f001c28424$6e27daf0$6701a8c0@tortilla
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I am having a problem with queries that return empty result sets. Whenever
I execute a query that returns no rows, the driver throws a SQLException:

No results were returned by the query.
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statem
ent.java:157)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statem
ent.java:141)

I'm assuming this is not the intended behavior, since it's perfectly
reasonable for a query to return an empty result set.

Looking at the source code for AbstractJdbc1Statement and working backwards,
the following seems to be happening:

1) executeQuery() starts looping over the current results until it finds one
that is "really" a result set
2) either AbstractJdbc1ResultSet.getNext() never returns a non-null result,
or AbstractJdbc1ResultSet.reallyResultSet() never returns true (I didn't
track it down that far).
3) looking at AbstractJdbc1ResultSet.getNext(), it simply returns the next
member variable
4) I didn't track down where the AbstractJdbc1ResultSet.next() method is
called, but this statement on line 65 caught my eye:

if (++current_row >= rows.size())
return false;

However, I'm not sure this is related at all since the "next" member
variable gets set by the append(), and I didn't track down where that is
called.

Any advice on this would be appreciated.

Thanks

Karl

Responses

  • Re: at 2002-11-04 17:18:56 from Dave Cramer
  • Re: at 2002-11-05 07:18:16 from Patrice Le Gurun

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2002-11-04 17:18:56 Re:
Previous Message Dave Cramer 2002-11-04 15:09:26 Re: DatabaseMetaData.getTables() problem