[Zope] how to get the fields returned SQL method
Eric BARROCA
eric@netsystems.fr
24 Mar 2000 13:52:50 +0100
Curtis Maloney <curtis@umd.com.au> writes:
> On Fri, 24 Mar 2000, Eric BARROCA wrote:
> > I'm trying to get a list of fields returned by a dynamic SQL query.
> > I've found a howto telling me to write something like :
> > <dtml-in SQL.names>
> > <dtml-var sequence-item>
> > </dtml-in>
> > But it doesn't work : I get the error "Attribute Error : names".
> > I've tried with .items, .keys and .fields too.
> Well, since the SQL will return a list, firsly you would have to index it...
> also, .keys et al are Python stuff, so...(untested)
> <dtml-in "SQL[0].keys()">
> might be more what you're looking for. Or...
> <dtml-in SQL>
> <dtml-in "keys()">
> <dtml-var sequence-item>
> </dtml-in>
> </dtml-in>
> should iterate through the keys of each line of the returned table.
It doesn't work too. I can't understand why.
More general, I'd like to extract all the variables available in a
namespace (and if I can do it, I'll can get the list of the fields).
Best regards,
EB.