Jeffrey P Shell wrote:

But SQL Method DTML is very very very very nice. It has a lot of type enforcement/safety measures (ie - autoquoting SQL Strings, ensuring that a 'sqlvar type=float' operation is inserting a float); a lot of *very* nice features for generating 'where' clauses (the sqltest 'optional' flag and the smart '<dtml-and> and <dtml-or>' tags that won't render if an optional 'sqltest' preceding them was not rendered); the 'sqltest multiple' feature is especially nice:

<dtml-sqlgroup where>
<dtml-sqltest foo type=nb multiple optional>
</dtml-sqlgroup>

If foo is a blank string or empty list, that will render nothing.

If foo is a single string, that renders::

where foo = 'bar'

But if foo is a list of strings, that will render::

where foo in ('bar', 'baz')

Doing that programatically in Python is counterintuitive and awkward (just as it was before the specialized 'dtml-sql___' tags in DTML). For simple queries, doing it in the host programming language is not bad. But for complex queries, it's very awkward to generate SQL. It's almost as bad as generating HTML inside of a programming language - it becomes difficult to maintain.

Yes, I think SQL methods are going to stick around. The downside is there are some things that they SHOULD do that they dont, and that DTML doesnt (to my knowledge) facilitate.

For example, <dtml-sqltest foo type=nb> ought to be able to check with the underlying DA, and ask that DA to help it format its parameters. Currently the render() method used by DTML seems to be presumed to be a string, but what you want back is

("foo=:foo", ('foo',foo)) # or whatever all this foo foo sounds like a poodle

so that any bind variables can be handled more efficiently by the DA. Since each DA handles bind variables differently, it has to be involved in the process to return a string with substitution text, and the value to be substituted later. The DA's query method currently takes only a string, but it should take a string and a concatenation of bind variables.

I remember looking at it and not wanting to get into trying to track down where DTML would have to change to allow nonlinear results.

There may well be something in DTML processing that would make this simple, I'm not very well versed on DTML processing internals.


--
Matt Kromer
Zope Corporation http://www.zope.com/


_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists - http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )


Reply via email to