[Zope] ZSQL: how to definde null

Christoph Landwehr chris-zopemailing at gmx.de
Mon Oct 20 18:57:11 EDT 2003


If posted twice: please excuse (mailserver problem at ISP)

Hi ,

I have a ZSQL method, that looks like

Attributes:
  some_name='empty'

UPDATE
    foo
SET
    bar = <dtml-sqlvar some_name  type="string">
WHERE
   some contitions ... ;

But when the variable "some_name" not is passed to the ZSQL method I 
don't want to have 'empty' in my db but a null value. So I changed the 
method to

SET
    bar = <dtml-if  "some_name=='empty'">null<dtml-else><dtml-sqlvar 
some_name  type="string"></dtml-if>

Maybe the is a more elegant way, like setting the default to null, so I 
can get rid of the if clause.
Thanx for any hints!
Regards Christoph







More information about the Zope mailing list