[Zope] structure of SQL result
Terry Hancock
hancock at anansispaceworks.com
Tue Mar 2 22:46:26 EST 2004
On Tuesday 02 March 2004 03:06 pm, Jim Penny wrote:
> On Tue, 2 Mar 2004 21:49:53 +0100
> Martin Herceg <martin at ufon.sk> wrote:
>
> > haloo
> > can anybody say me
> > when from script i call ZSQLMethod, how look result ?
> > is dictionary or what?
> >
> See
>
http://mail.zope.org/pipermail/zope-db/2003-July/001993.html
I believe you will also find you can simply address the
fieldnames as object attributes:
res[1].last_name
would get the contents of the field named "last_name" from
the second record of a results set (assuming that the SQL
asked for the "last_name" field to be returned, of course).
I think this will simplify the code in the reference above.
In other words, it looks like a "sequence of objects, with
attributes representing the queried fields".
I say "looks like", because if you look very closely, you
will find this is not really true and there are some more
esoteric things you can't do (I think inspecting __dict__
to find out what the attributes are is one of them) with
"results objects".
Cheers,
Terry
--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com
More information about the Zope
mailing list