[Zope-DB] ZSQL Result Set: How to find out column's names?
Dieter Maurer
dieter@handshake.de
Mon, 3 Feb 2003 20:37:52 +0100
M.-A. Lemburg wrote at 2003-2-3 17:01 +0100:
> The usual way to query for result columns is by adding a "and 1=0"
> to the WHERE clause, e.g. SELECT * FROM MyTable WHERE 1=0 will
> give you an empty result set.
>
> You should then be able to call the .name() method on the Results
> object which will give you the column names.
The method is called "names" not "name".
It works, too, when the query returns a non empty result.
I usually use:
<dtml-let result=callZSQLMethod
cols="result.names()"
>
<dtml-in result>
....
Dieter