[Zope] ZSQL
Dieter Maurer
dieter@handshake.de
Sun, 7 Apr 2002 22:15:52 +0200
Colin Fox writes:
> How do you use the <dtml-sqlgroup> & <dtml-where> clauses when you want
> to do a join?
Please see the embedded Zope Online Help:
Zope Help --> DTML-Reference --> sqlgroup
It has a complete example.
For qualified column access, you may also need the "column" attribute
to "sqltest".
It allows you to specify the column name.
When an optional part of an SQL group operand cannot be realized with
"sqltest", you can use direct SQL-fragments. The "sqlgroup"s
"and/or" will be generated when the operand is non-empty independent
on how it has been generated.
You example will look like:
select ...
<dtml-sqlgroup where>
i.owner_id = o.id
<dtml-and>
<dtml-sqltest owner_id column="o.id" type="int" optional>
</dtml-group>
Your ZSQL Method will need to list "owner_id" with a default value of "".
Dieter