[DB-SIG] Optional DB API Extensions

M.-A. Lemburg mal@lemburg.com
Wed, 24 Oct 2001 09:44:01 +0200

Federico Di Gregorio wrote:
> first of all, thank you very much for writing "what i wanted to write by
> i had not the time". here's a little addiction. some (longer) others
> will come. what about the distinction of Official extensions (if you
> implement the extension you _should_ implement it the dbapi way) and
> Unofficial ones? Can we consider the ones in this pep unofficial and the
> ones that get moved to the dbapi pep official? (s/// any term you like
> for official/unofficial.)
> here's my little addition:
>      Cursor Attribute .lastrowid
>          This read-only attribute provides the rowid of the last
>          modified row (most databases return a rowid only when a single
>          INSERT operation is performed.) If the operation does not set
>          a rowid or if the database does not support rowids, this attribute
>          should be set to None.

Looks OK (though I don't know how many DBs actually implement something
like this; I know that MySQL does, but are there others ?). 

One nit: like with all attribute extensions, if the database 
does not supply the feature the module should not implement the attribute
and if it cannot determine the value it should return -1 
(this simplifies checking and is more in sync with the other attributes).

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Consulting & Company:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/