db can be specified in cmd line option again
This commit is contained in:
parent
cad5149c0e
commit
b40132e961
|
@ -345,8 +345,10 @@ class Config:
|
||||||
self.supported_games[game.game_name] = game
|
self.supported_games[game.game_name] = game
|
||||||
|
|
||||||
# s_dbs = doc.getElementsByTagName("supported_databases")
|
# s_dbs = doc.getElementsByTagName("supported_databases")
|
||||||
if dbname and dbname in self.supported_databases:
|
# select database from those defined in config by:
|
||||||
self.db_selected = dbname
|
# 1) command line option
|
||||||
|
# or 2) selected="True" in config element
|
||||||
|
# or 3) just choose the first we come across
|
||||||
for db_node in doc.getElementsByTagName("database"):
|
for db_node in doc.getElementsByTagName("database"):
|
||||||
try:
|
try:
|
||||||
db = Database(node = db_node)
|
db = Database(node = db_node)
|
||||||
|
@ -360,6 +362,9 @@ class Config:
|
||||||
self.db_selected = db.db_name
|
self.db_selected = db.db_name
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
|
if dbname and dbname in self.supported_databases:
|
||||||
|
self.db_selected = dbname
|
||||||
|
|
||||||
|
|
||||||
# s_dbs = doc.getElementsByTagName("mucked_windows")
|
# s_dbs = doc.getElementsByTagName("mucked_windows")
|
||||||
for aw_node in doc.getElementsByTagName("aw"):
|
for aw_node in doc.getElementsByTagName("aw"):
|
||||||
|
|
|
@ -208,6 +208,7 @@ class Database:
|
||||||
if self.backend == self.SQLITE and db_params['db-databaseName'] == ':memory:' and self.fdb.wrongDbVersion:
|
if self.backend == self.SQLITE and db_params['db-databaseName'] == ':memory:' and self.fdb.wrongDbVersion:
|
||||||
log.info("sqlite/:memory: - creating")
|
log.info("sqlite/:memory: - creating")
|
||||||
self.recreate_tables()
|
self.recreate_tables()
|
||||||
|
self.fdb.wrongDbVersion = False
|
||||||
|
|
||||||
self.pcache = None # PlayerId cache
|
self.pcache = None # PlayerId cache
|
||||||
self.cachemiss = 0 # Delete me later - using to count player cache misses
|
self.cachemiss = 0 # Delete me later - using to count player cache misses
|
||||||
|
|
|
@ -137,7 +137,7 @@ class fpdb_db:
|
||||||
print "outdated or too new database version - please recreate tables"
|
print "outdated or too new database version - please recreate tables"
|
||||||
self.wrongDbVersion=True
|
self.wrongDbVersion=True
|
||||||
except:# _mysql_exceptions.ProgrammingError:
|
except:# _mysql_exceptions.ProgrammingError:
|
||||||
print "failed to read settings table - please recreate tables"
|
if database != ":memory:": print "failed to read settings table - please recreate tables"
|
||||||
self.wrongDbVersion=True
|
self.wrongDbVersion=True
|
||||||
#end def connect
|
#end def connect
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user