[Zope-DB] Building SQL on the fly?
VanL
vlindberg@verio.net
Tue, 12 Nov 2002 11:52:06 -0700
Hello,
I have read through all of the documentation that I can find, but I
can't see how to represent some needed SQL queries. For example, having
a variable number of parameters:
bugvalue=[]
SELECT apples_harvested FROM appletrees
<dtml-if bugvalue>
WHERE has_bugs NOT IN (<dtml-in bugvalue><dtml-sqlvar
sequence-item>,</dtml-in>)
</dtml-if>
So you could call it with the following query string:
/SQLgetAppleHarvest?bugvalue:tokens=yes%20maybe
and have it execute the following SQL:
SELECT apples_harvested FROM appletrees
WHERE has_bugs NOT IN ('yes','maybe');
whereas a query string:
/SQLgetAppleHarvest
would execute
SELECT apples_harvested FROM appletrees;
Does anyone know how to build these sort of queries on the fly?
Thanks,
VanL