Skip to content

Add Cursor.definition property #131

@rogerbinns

Description

@rogerbinns

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.

Original issue: http://code.google.com/p/apsw/issues/detail?id=131

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions