Re: Nmber of rows in a ResultSet

From: Kris Jurka <books(at)ejurka(dot)com>
To: Xavier Bugaud <xavier(dot)bugaud(at)gloptv(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Nmber of rows in a ResultSet
Date: 2004-01-09 08:25:32
Message-ID: Pine.LNX.4.33.0401090323370.6759-100000@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 9 Jan 2004, Xavier Bugaud wrote:

> Hi all,
>
> JDBC does not allow to directly retrieve the number of rows in a
> ResultSet.
> However, in old Postgres JDBC drivers (pgjdbc2.jar), the number of rows
> contained in a ResultSet could be obtained by calling getFetchSize().

This was just an implementation artifact and the javadoc for the method
should have made you wary of using it in the way you are.

> In the last JDBC drivers, is there a means to get the number of rows
> directly (without using 'SELECT COUNT(*)' or 'rs.last();rs.getrow();') ?

I don't see what's so wrong with rs.last() and rs.getRow().

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-01-09 08:33:02 Re: [BUG] - Invalid UNICODE character sequence found (0xc000)
Previous Message Kris Jurka 2004-01-09 08:18:33 Re: PreparedStatement parameters and mutable objects