checking if a sqlite connection and/or cursor is still open?

John Salerno johnjsal at NOSPAMgmail.com
Mon Oct 30 14:50:30 EST 2006


John Salerno wrote:
> Is there a way to check if a SQLite connection and cursor object are 
> still open? I took a look at the docs and the DB API but didn't see 
> anything like this.
> 
> Thanks.

Well, I might have somewhat solved this problem. Since SQLite allows you 
to use execute* methods directly on the connection object (thus no need 
to create a cursor object), all I need to do is call connection.close() 
and this doesn't seem to raise an error even if the connection has 
already been closed.

I'm still curious if there's a way to check for an open connection, but 
it seems like without the cursor object, the task is much easier.



More information about the Python-list mailing list