Revert "Database: Disable alchemy pools" as that breaks the HUD (on PS at least)

This reverts commit 797c126318.
This commit is contained in:
Steffen Schaumburg 2010-12-26 19:16:38 +01:00
parent b62a811e23
commit dc28c31e02

View File

@ -60,14 +60,11 @@ import Configuration
# Other library modules # Other library modules
try: try:
import sqlalchemy.pool as pool import sqlalchemy.pool as pool
#use_pool = True use_pool = True
# Forcing to False so we can use connection.row_factory
use_pool = False
except ImportError: except ImportError:
log.info(_("Not using sqlalchemy connection pool.")) log.info(_("Not using sqlalchemy connection pool."))
use_pool = False use_pool = False
try: try:
from numpy import var from numpy import var
use_numpy = True use_numpy = True
@ -450,8 +447,7 @@ class Database:
self.db_path = database self.db_path = database
log.info(_("Connecting to SQLite: %(database)s") % {'database':self.db_path}) log.info(_("Connecting to SQLite: %(database)s") % {'database':self.db_path})
if os.path.exists(database) or create: if os.path.exists(database) or create:
self.connection = sqlite3.connect(self.db_path, detect_types=sqlite3.PARSE_DECLTYPES) self.connection = sqlite3.connect(self.db_path, detect_types=sqlite3.PARSE_DECLTYPES )
self.connection.row_factory = sqlite3.Row
self.__connected = True self.__connected = True
sqlite3.register_converter("bool", lambda x: bool(int(x))) sqlite3.register_converter("bool", lambda x: bool(int(x)))
sqlite3.register_adapter(bool, lambda x: "1" if x else "0") sqlite3.register_adapter(bool, lambda x: "1" if x else "0")