[Zope] ZSQL Method result fields names?

Jim Penny jpenny@universal-fasteners.com
Fri, 5 Apr 2002 12:50:02 -0500


On Fri, Apr 05, 2002 at 03:35:48PM +0700, Paul Latushko wrote:
> Hello all,
> 
> Suppose I have ZSQL Method called SelectCustomers:
> 
> -----
> 
> select * from Customers
> 
> -----
> 
> In my Python script I have:
> 
> -----
> 
> Result = context.SelectCustomers
> 
> -----
> 
> I can get values from Result:
> 
> Result[recordIND][fieldIND]
> 
> But how can I get the names of fields in Result (suppose I don't know the
> structure of Customers table)?

This is somewhat Database Adapter dependent. Result.names() is normally
a list of names of fields.  (It can also be found as Result._names, and
in Result.data_dictionary()--this gives much additional information, but
the interpretation is very DA dependent.)

Jim Penny

> 
> Any ideas?
> 
> Thanks in advance,
> 
> Paul.