scrollable ResultSet advise

Поиск
Список
Период
Сортировка
Искать

scrollable ResultSet advise

От:
Achilleas Mantzios <achill@matrix.gatewaynet.com>
Дата:
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

Re: scrollable ResultSet advise

От:
Kris Jurka <books@ejurka.com>
Дата:


On Mon, 12 May 2008, Achilleas Mantzios wrote:

> 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.

The easiest thing would just be to adjust the driver source code to 
restore the old behavior.

Kris Jurka

Re: scrollable ResultSet advise

От:
Achilleas Mantzios <achill@matrix.gatewaynet.com>
Дата:
Στις Thursday 15 May 2008 09:14:52 ο/η Kris Jurka έγραψε:
> 
> On Mon, 12 May 2008, Achilleas Mantzios wrote:
> 
> > 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.
> 
> The easiest thing would just be to adjust the driver source code to 
> restore the old behavior.
Thanx,
I thought about it and abandoned that idea, since i speculate it would come back and bite me sometime in the future. 
Also now the fact that jdbc is not in the server source base it is even more discouraging.
i just rewrote the prepareStatement()'s calls.
Thanx for your answer.
> 
> Kris Jurka
> 



-- 
Achilleas Mantzios
FAQ