[Zope] Re: how do I get field names from a query
Adam Molyneaux
adam.molyneaux@epfl.ch
Wed, 31 May 2000 14:27:46 +0200
still trying to get field names from a query of the form
SELECT * FROM MYTABLE
><dtml-in "sqlListTable(table_name='personnel')">
> <dtml-in sequence-item>
> <P><dtml-var sequence_key>
></dtml-in >
doesnt seem to work
niether does the How To http://www.zope.org/Members/teyc/howtoSQLVariables
assuming I have understood it correctly
ie.
<dtml-let R="sqlListTable(table_name='personnel')">
<dtml-in SQL.names>
<dtml-let vname=sequence-item
vvalue="SQL()[0][_['sequence-index']]">
<dtml-var vname>,
<dtml-var vvalue><br>
</dtml-let>
</dtml-in>
</dtml-let>
FINALLY I have succeded in doing what I want by using an external method
which returns the list of fieldname !
ie.
def getFieldNames(self,res):
fieldnames=res._schema.items()
return fieldnames
I would still be interested in knowing how to do the job correctly.
adam
adam.molyneaux@epfl.ch