|
Log note : Problems when using sqlite
|
|
added:
From wiki Tue Mar 27 01:40:48 +1000 2007
From: wiki
Date: Tue, 27 Mar 2007 01:40:48 +1000
Subject: Problems when using sqlite
Message-ID: <20070327014048+1000@www.mechanicalcat.net>
When a single-user database backend (e.g. SQLite) is used, problems might occur because the database is locked when someone else tries to access it. Therefore it might be necessary to close the connection after use (untested):
def close_db()
global db
db.close()
db = None
def useful_function(...):
"no db argument required nor supported"
global db
check_db()
try:
# do the interesting stuff and, when writing,
# don't forget to commit()...
return interesting_data
finally:
close_db()
Just in case... I didn't suffer any problems myself.