[ZDP] BackTalk to Document The Zope Book (2.6 Edition)/Relational Database Connectivity

webmaster at zope.org webmaster at zope.org
Sat Nov 5 09:38:42 EST 2005

A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/RelationalDatabases.stx#2-51


    Querying a relational database returns a sequence of results. The items
    in the sequence are called *result rows*.  SQL query results are always a
    sequence. Even if the SQL query returns only one row, that row is the
    only item contained in a list of results.

      % Anonymous User - July 14, 2004 7:06 pm:
       it would be nice if in here it talked about null values and what would be the proper way to deal with them...
       eg: where someone might have a middle name, and if they don't and you say:
       <dtml-var middle_name>

       then it would print None... where as you probably want it to not print the None. i got it to work with the
       <dtml-if middle_name>
          <dtml-var middle_name>

       but i have no clue if that is the best way to do it.

      % Anonymous User - May 23, 2005 5:29 pm:
       You would use
       <dtml-sqlvar middle_name type=nb optional> 

      % Anonymous User - Aug. 15, 2005 12:35 pm:
       But this will fail if the variable is an integer. If the value is 0, then <dtml-if ..> interpret this as
       false, not 0, and the 0 will not be printed.

      % Anonymous User - Aug. 15, 2005 12:44 pm:
       Test with <dtml-if "middle_name != None">

      % Anonymous User - Nov. 5, 2005 9:38 am:
       <dtml-var middle_name null="">

More information about the ZDP mailing list