scrollable ResultSet advise

From: Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: scrollable ResultSet advise
Date: 2008-05-12 08:47:13
Message-ID: 200805121147.13613.achill@matrix.gatewaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi, i am just migrating from 7.4 to 8.3, and i have this issue:
In the old 7.4 days i wrote a simple function to get the size of a ResultSet.
public static int FS(ResultSet rs) throws SQLException{ /* fetch size */
rs.last();
int cnt = rs.getRow();
rs.beforeFirst();
return cnt;
}

However, in plain connnection.prepareStatement(String sql) calls, ResultSet type defaults to FORWARD_ONLY,
making the above code broken.

I am wandering if there is a quick way to solve this problem, without touching the huge number of PreparedStatements
in the code.
Has anyone solved this problem using some kind of a wrapper, e.g. using wrapper classes from jboss?
--
Achilleas Mantzios

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message sangeetha 2008-05-13 12:50:53 Re: 25P02, current transaction is aborted, commands ignored
Previous Message tivvpgsqljdbc 2008-05-12 08:10:31 Re: Correct getScale() behavior?