[Zope-dev] How to invoke a Z SQL method from python

Martijn Pieters mj@antraciet.nl
Fri, 03 Sep 1999 19:47:04 +0200


At 18:37 3-9-99 , Jim Penny wrote:
>Sorry to bother you again, but how do I get at the results?
>I.e., I can see that a=self.sql_test(request_number=44) is
>triggering a SQL query.  But now I can't figure out the
>number of rows selected, the size, or the contents of the rows.
>
>Thanks in advance, and I promise I won't bother you again for a month!

Just keep bothering the list =) It is weekend for me now.. =)

Returned is a list of row objects, and each row object is just a dumb class 
with the different columns converted to class attributes.

So you test for the length of the result, loop through it like any list and 
access attributes on the list objects, including list.__dict__.keys() for a 
list of attributes.

--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| T: +31 35 7502100 F: +31 35 7502111
| mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
---------------------------------------------