[egenix-users] column names ?
j vickroy
jgv-work at earthlink.net
Mon Aug 4 17:03:42 CEST 2003
Hello Phil,
After a query retrieval (e.g., cursor.fetchall()) look at the
cursor.description attribute. In particular, element zero of each tuple,
that is cursor.description, should contain the column name.
----- Original Message -----
From: <stuff at mailzilla.net>
To: <egenix-users at lists.egenix.com>
Sent: Monday, 04 August, 2003 14:59
Subject: [egenix-users] column names ?
>
> Is there a way, via mxODBC to obtain the column names for a particular
> query. For example,
>
> c = db.cursor()
>
> sql = "SELECT * FROM foo"
> c.execute(sql)
>
>
> I've tried c.columns() (before and after a fetchone()) but that always
> yields -1 (at least when connected to SQL Server).
>
> c.colcount seems to return the correct number of columns, so that could be
> useful. Is there a way to map the column name to a column number. That
> is, if I have a colcount of 10, how can I determine the name of column 4?
>
> I suspect the answer is "no" considering that the pretty_print mx.ODBC
> method seems to be unaware of the column names (at least according to the
> mxODBC examples on the web site).
>
> Thanks for any info,
>
> Phil
>
>
>
> _______________________________________________________________________
> eGenix.com User Mailing List http://www.egenix.com/
> http://lists.egenix.com/mailman/listinfo/egenix-users
More information about the egenix-users
mailing list