|
From: Oleg B. <ph...@ph...> - 2012-02-01 15:50:11
|
On Wed, Feb 01, 2012 at 03:28:30PM +0100, Daniel Dehennin wrote:
> Rebuildd().sqlconnection.close()
Aha, got it. You've stumbled upon a subtle bug in SQLiteConnection.
SQLiteConnection uses a different (from its parent class DBAPI)
implementation of .getConnection() and maintain its own pool -
._threadPool along with DBAPI._pool. But it doesn't clear the pool on
.close().
The quick-and-dirty solution for you is to clear the pool yourself:
Rebuildd().sqlconnection.close()
Rebuildd().sqlconnection._threadPool = {}
I'll add a proper .close() to SQLiteConnection.
> sqlobject.sqlhub.processConnection = Rebuildd().sqlconnection
You preserve an old SQLiteConnection, so you don't need the
following:
> sqlobject.dbconnection.TheURIOpener.cachedURIs={}
The workaround is for the case when you want to create a new
SQLiteConnection like this:
Rebuildd().sqlconnection = connectionForURI(...)
And, BTW, this
> os.unlink("/tmp/rebuildd-tests.db")
is just
Rebuildd().sqlconnection.dropDatabase()
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|