-
Notifications
You must be signed in to change notification settings - Fork 102
Description
From piranna on May 11, 2012 12:44:25
On DB-API 2.0, the Cursor instances has a definition property that has the same purpose and return similar data that the getdefinition() method, and also the most used data of the returned tuples (the name of the columns) is in both at the offset 0, but since you can't subclass the APSW Cursor class you can't be able to add the property and develop portable code at this point. The fact is that is easy to get over this with some code like:
try:
description = cursor.description
except AttributeError: # APSW
description = cursor.getdescription()
but it's ugly since you have to had specialized code for something fairly trivial. Since that, i propose to add a definition property according to the DB-API 2.0. This states that it have to return a tuple with the next fields:
name,
type_code,
display_size,
internal_size,
precision,
scale,
null_ok
Since the first two are the same that the getattribute() method it should be fairly trivial, while for the other five since don't have sense on SQLite it could be possible to do the same that PySqlite does, that it's just return None on the fields.