mysql_fetch_fields()
Irene Barg
ibarg at as.arizona.edu
Mon Aug 7 09:56:19 EDT 2000
System: RedHat Linux 6.1, MySQLdb-0.2.1,
mysql-3.22.32 python-1.5.2
Problem:
I want to imlement a MySQL SAX driver as provided in Sean
McGrath's "XML Processing with Python". I'm having to change
some of the module function calls to meet MySQLdb-0.2.1.
However, i cannot map the follow correctly:
....
# Perform the query
#qry = self.db.query(self.QueryExpression)
qry = self.db.cursor()
qry.execute(self.QueryExpression)
# fields is a list of fields in each row
#self.fields=qry.fields()
???can't use list_fields()????
# rows is a list of result rows
#rows=qry.fetchrows()
rows= qry.fetchall()
.....
'qry.fields()' is not implemented in MySQLdb-0.2.1, but the method
'conn.list_fields('table') exists. But you need to know the
table, which in the above code, the 'table' is embedded in the
QueryExpression. If I grep for 'field' in the MySQLdb-0.2.1
directory, i see:
_mysqlmodule.c: fields = mysql_fetch_fields(self->result);
Instead of a connection object, it expects a result object? How
could I use this function inside my Python code above?
I have spent hours trying to figure this out. Your comments are
greatly apreciated.
Thanks,
--irene
--
------------------------------------------------------------------
Irene Barg Email: ibarg at as.arizona.edu
Steward Observatory Phone: 520-621-2602
933 N. Cherry Ave.
University of Arizona FAX: 520-621-1891
Tucson, AZ 85721 http://nickel.as.arizona.edu/~barg
------------------------------------------------------------------
More information about the Python-list
mailing list