[Zope-DB] Relational Databases in Zope 2 and Zope 3
tseaver at zope.com
Tue Jun 29 10:09:15 EDT 2004
Smith, Neil (Worcester) wrote:
> The point of the dtml-sqlgroup and dtml-sqltest is surely to provide a nice
> way of handling the case where you don't pass in the parameter, so it
> doesn't render the WHERE, AND, = etc. And it does this quite well.
> If you remove it, then you'll need either an exponential number of SQL
> methods and some logic before it to decide which to call, or you'll have to
> fill the SQL method with even more confusing dtml-if statements, or you'll
> have to have your SQL something like:
> WHERE (
> <dtml-sqlvar parameter_1 type=..> is null or
> column_1 = <dtml-sqlvar parameter_1 type=..>
> ) and (
> <dtml-sqlvar parameter_2 type=..> is null or
> column_2 = <dtml-sqlvar parameter_2 type=..>
> which again seems more confusing, (and in fact doesn't work if a parameter
> is a number rather than a string).
The dilemma here is similar to the classic one between OLAP and OLTP:
arbitrarily flexible queries are death to transactional throughput.
If your application *needs* this flexibility, then you *can't* take
advantage of prepared queries anyway, as there is no "canonical" version
of the query to prepare. There are is *huge* space of applications,
however, which *could* benefit from prepared queries; for them the
price of DTML's flexibility is both painful and unneccessary.
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the Zope-DB