ResultProxy_instance.cursor.description returns the 7-tuple as defined in the Python DB API containing information about the result set.

The type_code (the second element of each tuple) is an integer:

(('id', 20, 5, 8, None, None, None), ('idgattung', 23, 2, 4, None, None, None), ('bezeichnung', 1043, 43, 255, None, None, None), ('version', 1043, 0, 30, None, None, None), ('stand', 1114, 19, 8, None, None, None), ('format', 1043, 3, 10, None, None, None), ('status', 23, 1, 4, None, None, None), ('umfang', 23, 1, 4, None, None, None), ('seiten', 23, 1, 4, None, None, None), ('faxabruf', 1043, 0, 50, None, None, None), ('dateiname', 1043, 11, 255, None, None, None), ('originalname', 1043, 30, 255, None, None, None), ('idautor', 23, 1, 4, None, None, None), ('idfassung', 23, 1, 4, None, None, None), ('neudat', 1114, 19, 8, None, None, None), ('aedat', 1114, 19, 8, None, None, None), ('bemerkung', 25, 0, -1, None, None, None), ('summary', 25, 74, -1, None, None, None))

AFAIK all type_codes are specific to the underlying Python DB module. Is there a way to determine the type of a column for a given resultset (as returned by executing a SQL statement directly) independent of the underlying database?

The reason why I am asking: I am building a generic database adapter for Zope 2 where I need map the types of the columns to some Zope internal
mapping.

Andreas

Attachment: pgpl2nUfNnRQo.pgp
Description: PGP signature

Reply via email to