cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: [C2] xsp in esql ? (was Re: [C2] esql connections diff)
Date Wed, 08 Nov 2000 05:58:34 GMT
On Sat, 4 Nov 2000, Marcus Crafter wrote:

> Hi Donald (and others),
> 
> 	What are your thoughts about being able to parameterize the queries
> 	with your suggested syntax, perhaps with xsp ? For example:
> 
> <esql:connection>
> 
> 	<esql:driver>...</esql:driver>
> 
> 	<xsp:logic>
> 		for (int i=0; i &lt; sz; i++) {
> 			<esql:execute-query>
> 				<esql:query>
> 					INSERT INTO mytable VALUES
> 					('<xsp:expr>field[i]</xsp:expr>');
> 				</esql:query>
> 			</esql:execute-query>
> 		}
> 	</xsp:logic>
> 
> </esql:connection>
> 
> 	This is something we've done here in C1 using the SQL processor (xsp
> 	is done first, then the sql processor). Such abilities in esql would
> 	also be very useful.
> 	
> 	I guess it's a general question about using xsp within esql.
> 	What do you think ? (or is this already possible ?)

yes, it's already possible - you want to use prepared statements here so
that you don't have to worry about escaping apostraphes and such. try:

<esql:statement>insert into mytable values (
 <esql:parameter><xsp:expr>field[0]</xsp:expr></esql:parameter>
)
</esql:statement>

i'm probably going to merge the statement and query elements, i'll just
consider a query to be a prepared statement if a parameter element appears
inside it. :)

- donald


Mime
View raw message