> how do I get the names of the fields returned from a SQL query ?
> ( I would like to generate stuff using the names automatically)
> I know they must be available because I can use them directly !
The result of the SQL query has a method 'names()' that contains
the column names. N.B. This is a method of the result, not a
method of the individual rows, so you cannot normally get at it
directly while iterating over the result.
>
> I've tried lots of alternatives of the form
>
> <dtml-in "sqlListTable(table_name='personnel')">
> <dtml-in sequence-item>
> <P><dtml-var sequence_item>
> </dtml-in >
Try:
<dtml-let query="sqlListTable(table_name='personnel')"
names="query.names()">
<dtml-in query>
<dtml-in names>
<dtml-let column=sequence-item>
<dtml-var column> is <dtml-var "_[column]"><br>
</dtml-let>
</dtml-in>
</dtml-in>
</dtml-let>
--
Duncan Booth [EMAIL PROTECTED]
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan
_______________________________________________
Zope maillist - [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope-dev )