[DB-SIG] Reuse of DB-API 2.0 cursors for multiple queries?

Andy Todd andy47 at halfcooked.com
Thu Jan 29 22:05:47 CET 2009

M.-A. Lemburg wrote:
> On 2009-01-29 21:15, Alex Willmer wrote:
>> (Reposted to DB-SIG from clp)
>> This week, I used the adodbapi module against an SQL Server Express
>> database. I was surprised to get an exception, when I attempted to
>> submit a second query with my cursor object. The full session is
>> below.
>> With cx_Oracle I've become used to reusing a cursor for subsequent
>> queries. The PEP doesn't specify either way, that I can see. Is this
>> behaviour left to the implementation, or should I be able to expect a
>> cursor is reusable?
> This should be possible. In fact the statement caching mechanism outlined
> in the DB-API spec relies on this: if you pass in the same query twice,
> the module can opt to reuse the already prepared statement.

In that case shouldn't the DB-API be amended to say this? After all 
"explicit is better than implicit".

 From the desk of Andrew J Todd esq - http://www.halfcooked.com/

More information about the DB-SIG mailing list