[Zope] Z SQL Method Question

Dieter Maurer dieter@handshake.de
Wed, 28 Feb 2001 20:51:53 +0100 (CET)


Donald Braman writes:
 > I'm trying to build a query with three optional variables and three 
 > optional operators. I think I have a form that supplies the variables 
 > correctly, but am less certain about DTML use in a SQL query. Here's 
 > what I'm doing:
 > 
 > SELECT * FROM cases
 > WHERE makepublic = 't'
 > <dtml-if citationin>AND citation <dtml-var citationop> citationin 
 > </dtml-if>
 > <dtml-if casenamein>AND casenameshort <dtml-var casenameop> casenamein 
 > </dtml-if>
 > <dtml-if yearin>AND year <dtml-var yearop> yearin </dtml-if>
Have a look at "dtml-sqlgroup". This may allow you to get
rid of the nasty "dtml-if".

I expect, "citationin", "casenamein" and "yearin" are
Z SQL arguments and not field names?

  In this case, you would need a "dtml-sqlvar" to access their
  value.


Dieter