cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <o...@vip.net.pl>
Subject Re: ESQL and prepared statements
Date Wed, 05 Mar 2003 12:59:26 GMT
On śro, mar 05, 2003 at 01:37:57 +0100, Christian Haul wrote:
> 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,
why is that?

for example you want to place an order. The way I do it (using client app
instead of browser) is to send an xmlfile
<root>
	<contractor-id>10<contractor-id>
	<positions>
		<position>
			<good-id>2</good-id>
			<amount>10</amount>
		</position>
		<position>
			<good-id>5</good-id>
			<amount>22</amount>
		</position>
	</positions>
</root>

as a request body . The xsp action parses the document, valiates data against
the database (checks if contractor, goods exist), then performs several insert
(order header, repeated inserts into order positions table). ESQL is a great
help in that and there is really no other way to achieve this (modular
database actions rather wouldn't help and even if they did a massive amount of
logic would end up in the sitemap which in my case is not small even now).

What you say is maybe true when cocoon serves content for web browsers but I
find cocoon a great tool acting as a application server layer - I do not know
EJBs and stuff and from what I saw the development time would be much bigger.
I have:
1. xsp as data providers
2. xsp actions as logic performers 
3. authentication framework as .. authentication frameork
4. siteap - lets me create any application folder hierarchy I want.

There's an apache in front of this all which compresses all output data (using
mod_gzip) to 5% of its original size. Got all what is needed to be happy
forever :)

And reusing the same pipelines I can build web administrator application very
fast.
	ouzo
-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


Mime
View raw message