Implemented persistent database connections.

Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
This commit is contained in:
Aymeric Augustin 2013-02-18 11:37:26 +01:00
parent d009ffe436
commit 2ee21d9f0d
16 changed files with 220 additions and 25 deletions

View file

@ -439,6 +439,14 @@ class DatabaseWrapper(BaseDatabaseWrapper):
cursor = self.connection.cursor()
return CursorWrapper(cursor)
def is_usable(self):
try:
self.connection.ping()
except DatabaseError:
return False
else:
return True
def _rollback(self):
try:
BaseDatabaseWrapper._rollback(self)