[Zope-DB] Re: Easier updates with <dtml-sqlgroup set> and <dtml-comma>?

Charlie Clark charlie@begeistert.org
Tue, 19 Nov 2002 23:12:02 +0100


On 2002-11-19 at 19:01:28 [+0100], Jeff Kowalczyk wrote:
> It's probably a sign that a patch should aspire to be in the core if a 
> zsql-newbie wishes for an api out of the blue and the verbatim match 
> already exists. Who to ask about applying that diff to sqlgroup.py for 
> future Zope releases? (AFAICT the Aqueduct.py diff is unnecessary for 
> this particular purpose, and the sqlgroup patch seems pretty harmless)
> 
> update Shipments
> <dtml-sqlgroup set noparens>
>   <dtml-sqltest ShipperInvoiceID type="nb" op="eq" optional> <dtml-comma>
>   <dtml-sqltest ShipperChargeAsBilled type="float" op="eq" optional> 
>   <dtml-comma>
>   <dtml-sqltest ShipperChargeAsPaid type="float" op="eq" optional>
> </dtml-sqlgroup>
> where ShipmentID = <dtml-sqlvar ShipmentID type="nb">

Hi Jeff,

this and the other example you quote when you start passing in lists sound 
like good reasons to me to ask myself: why do I want to do this in DTML? 
<DTML-SQLVAR> is useful but what the hell is the point of <dtml-comma>? 
It's so much nicer to do this with Python. Maybe I'm the only one but I 
have never understood the advantage of <dtml-sqltest> over standard SQL. I 
think it's less legible and, therefore, less usable. It's nice to be able 
to test the SQL as it is say in a command line without having to mentally 
recreate it. Of course, I do use <dtml-if> to generate the statements but 
once I have a couple of <dtml-if><dtml-elif><dtml-else></dtml-if> nestings 
I know I'm in trouble and take the time to sort and classify the data 
before passing it to DECLARATIVE and therefore fast but stupid SQL. Maybe 
we'll end up being able to use Python directly in DTML, although that 
probably isn't necessary seeinf as you can call the aPI directly from a 
PythonScript or an ExternalMethod. Haven't done either myself yet.

Charlie