Re: checking if a sqlite connection and/or cursor is still open?
- From: "Nick Vatamaniuc" <vatamane@xxxxxxxxx>
- Date: 30 Oct 2006 15:53:39 -0800
I am not familiar with SQLite driver, but a typical Pythonic way to
check if you can do something is to just try it, and see what happens.
In more practical terms: try to just use the cursor or the connection
and see if an exception will be raised.
Nick V.
John Salerno wrote:
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.
.
- References:
- checking if a sqlite connection and/or cursor is still open?
- From: John Salerno
- Re: checking if a sqlite connection and/or cursor is still open?
- From: John Salerno
- checking if a sqlite connection and/or cursor is still open?
- Prev by Date: Re: dict problem
- Next by Date: Re: How can I import a script with an arbitrary name ?
- Previous by thread: Re: checking if a sqlite connection and/or cursor is still open?
- Next by thread: create global variables?
- Index(es):
Relevant Pages
|