clear player cache when recreating database

This commit is contained in:
sqlcoder 2010-07-14 21:07:20 +01:00
parent 397e87b800
commit 3657327566
2 changed files with 8 additions and 0 deletions

View File

@ -1114,6 +1114,7 @@ class Database:
"""(Re-)creates the tables of the current DB""" """(Re-)creates the tables of the current DB"""
self.drop_tables() self.drop_tables()
self.resetPlayerIDs()
self.create_tables() self.create_tables()
self.createAllIndexes() self.createAllIndexes()
self.commit() self.commit()
@ -1853,6 +1854,9 @@ class Database:
#FIXME: recognise currency #FIXME: recognise currency
return tmp[0] return tmp[0]
def resetPlayerIDs(self):
self.pcache = None
def getSqlPlayerIDs(self, pnames, siteid): def getSqlPlayerIDs(self, pnames, siteid):
result = {} result = {}
if(self.pcache == None): if(self.pcache == None):

View File

@ -409,6 +409,10 @@ class fpdb:
# self.release_global_lock() # self.release_global_lock()
# lock_released = True # lock_released = True
self.db.recreate_tables() self.db.recreate_tables()
# find any guibulkimport windows and clear player cache:
for t in self.threads:
if isinstance(t, GuiBulkImport.GuiBulkImport):
t.importer.database.resetPlayerIDs()
self.release_global_lock() self.release_global_lock()
#else: #else:
# for other dbs use same connection as holds global lock # for other dbs use same connection as holds global lock