cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@dvs1.informatik.tu-darmstadt.de>
Subject Re: ESQL and prepared statements
Date Wed, 05 Mar 2003 12:37:57 GMT
On 05.Mar.2003 -- 11:42 AM, Leszek Gawron wrote:
> you may do something like:
> 
> <esql:declare-prepared-query id="prepared-no1">
> 	select foo from bar where blah = <esql:parameter name="firstparam"/>
> </esql:declare-prepared-query>
> 
> <xsp:logic>
> int i;
> for ( i = 0; i < count; ++i ) {
> 	<esql:set-param query="prepared-no1" name="firstparam">
> 		<xsp:expr>somearray[ i ]</xsp:expr>
> 	</esql:set-param>
> 
> 	<esql:run-prepared-query id="prepared-no1">
> 		<esql:results>
> 			<!-- standard stuff goes here -->
> 		</esql:results>
> 	</esql:run-prepared-query>
> }
> </xsp:logic>
> 
> What do you think ? 

Sounds reasonable. Although I fear changes to esql.xsl and helper
classes might be cosiderable to achieve this.

This would lead to the question: Is it worth it? I mean, in my book
ESQL should be used to generate content only, not for update,
insert or delete. And for that it's probably less often useful to
repeat a query a number of times. Would be different of course, if the
statement would be kept over different invocations of the page (the
driver or the DBMS might do it for prepared statements).

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

Mime
View raw message