[Zope-DB] how to fetch and set a value from a result object

Dieter Maurer dieter@handshake.de
Fri, 13 Dec 2002 23:06:52 +0100

Robert Van Overmeiren writes:
 > I would like to know how to interate over a Z SQL Method result object,
 > which returns a single unique result, and set a variable's value to this
 > unique result within a python external method.
 > My query is passed a username and it selects the latest login time for the
 > username. I tried this:
 > timestamp = context.select_log_time(username=Username)
This behaves like a sequences of rows; each row like an object
with the column names as attriutes.

This means, you should use something like:

     timestamp= context.select_log_time(...)[0].timestamp