[Zope] Return object from a ZSQL method

Allen Wallis allen@rrsg.ee.uct.ac.za
Thu, 06 Apr 2000 10:47:45 +0200


Hi,
I'm still puzzled by the actual type of the object returned from a
ZSQL method (a SELECT query). At the moment I've been getting by with
something along the lines of
<dtml-let results="queryDatabase">
    <dtml-if "results">
        Results:
        <dtml-in results>
            <dtml-var col_name>
            ...
        </dtml-in>
    <dtml-else>
        No Results
    </dtml-if>
</dtml-let>
where col_name is some column name, and queryDatabase is my ZSQL method.

However I now have the case where this is not working as expected. The
results object returned always evaluates true when tested (even when
empty). Also, when I tried to use the _.len(results) method, it always
returns 1. I thought it might return the number of records that were
found in the SQL query.
Can someone please explain where I'm going wrong, and possibly also tell
me the type of object that is returned by a ZSQL method. I've been
reading the ZSQL manual but can only find how to use your own class.

thanks
Allen