cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@odoko.co.uk>
Subject SQL and CTemplate (was Re: [RT] Rules for adding blocks and functionality?)
Date Wed, 26 Oct 2005 20:44:23 GMT
Daniel Fagerstrom wrote:
> Sylvain Wallez wrote:
> 
>> Carsten Ziegeler wrote:
>>
>>> Daniel Fagerstrom wrote: 
>>>
>>>> We are chosen as committers as induviduals and not as representants
>>>> for our companies. From a community stand point I would say that it
>>>> is time to deprecate the SQLTransformer. As a representative for my
>>>> company I would rather say: no way, we have tons of code that depend
>>>> on it. It is a complicated question, but I don't think that the
>>>> answer is: I need it at my work so the rest of you should support it.  
>>>
>>>
>>> It is really hard to tell what is still useful and what not. Now, the
>>> simple example of the SQLTransformer shows this: most of us seem to
>>> agree that it's some legacy component and that flow etc. should be used
>>> instead.
>>> Now, think of a reporting tool done with Cocoon. This fetches some
>>> hundreds of MB out of the database and just displays them. In this case
>>> everything other than the SQLTransformer + Stylesheet is simply overkill
>>>  (ok, XSP+ESQL is fine as well) and too memory/time consuming. 
>>
>>
>> Agree. The really ugly part of SQLTransformer is its ability to
>> perform insert/updates.
>>
>> I'm using ESQL in a number of places for publication purposes, and
>> many people agree that ESQL is what keeps XSP alive. We have to build
>> an equivalent for CTemplates.
> 
> 
> As you might remeber the CTemplate framework was designed with that in
> mind. It is rather simple to add a set of external instructions to
> CTemplate.  But we had a long and not especially nice discussion about
> such thing a while ago, and the conclusion was that the community didn't
> want such things.
> 
> Now, I find it rather strange to keep the SQLTransformer and ESQL
> because some people find them being the best way to do simple reporting
> at the same time as the community strongly oppose building a modern
> replacement of them in CTemplate, because they represent bad practice.
> 
> Anyway, for the time beeing I think it is better to focus on making it
> as easy as possible to use SQL from flowscripts and present the result
> sets in CTemplate. Then if we don't get it easy enough we can start to
> think about doing part of ESQL in CTemplate.

Whilst I'm not going to be the person implementing it, having seen the
distinction made between SELECT and UPDATE in ESQL/SQLTransformer, I'd
happily see tags added to CTemplate to allow for SQL querying, without
the ability to update/insert.

Surely the main thing about a template is that it is side-effect free,
and that would be.

Maybe better would be some way to separate the SQL from the template.
Imagine:

<esql:select name="my-query" idEmployee="#{request.getParameters('id')}/>

And queries.sql:

my-query: SELECT * FROM Employee WHERE idEmployee = ${idEmployee}
my-other-query: SELECT * FROM Employers

I guess you'd define your queries.sql file in the <map:generators>
section of your sitemap.

The worst thing about ESQL/SQLTransformer in my view is the embedded
SQL. Horrible.

Regards, Upayavira

Mime
View raw message