cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@apache.org>
Subject Re: cvs commit: cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp JdbcEsqlQuery.java
Date Wed, 11 Jun 2003 18:24:14 GMT
>>  reusing the statement for the limit clause seems not to always work,
>>reverting to the proposed JDBC way until this got fixed in the
>>AbstractEsqlQuery
> 
> 
> Hi torsten!
> 
> What this mean? Can you explain a little more about this?

Sure....

the problem is to know about the number of rows in the rowset.

The current implementation used a prepared statement that got
the parameters assigned

   PreparedStatement st = conn.prepareStatement(..);

   st.setInt(1,...)
   ...

and reused this statement (including the assigned parameters) to
execute another query - the count query. Which is unfortunately
dead wrong :-/

  st.execute(); // the original esql query
  st.execute( select count(*) from ... ) // the count query

(because actually only the original query can be prepared)

That way we are assuming that

  a) the parameters are still valid for another query
  b) the statement can be reused for another query

Unfortunately these are too many assumptions for some jdbc drivers ;)
...but this time they are not to blame since it really feels wrong.

So I reverted to the old way. I see some spare time coming up and it's
on top of my todo list. Unfortunately I see no quick fix except the
current reversion.
--
Torsten


Mime
View raw message