From 3657327566c43c0c4e96dc972dcb4bdcc08931e1 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Wed, 14 Jul 2010 21:07:20 +0100 Subject: [PATCH] clear player cache when recreating database --- pyfpdb/Database.py | 4 ++++ pyfpdb/fpdb.pyw | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index e6b72c1e..385e61a7 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1114,6 +1114,7 @@ class Database: """(Re-)creates the tables of the current DB""" self.drop_tables() + self.resetPlayerIDs() self.create_tables() self.createAllIndexes() self.commit() @@ -1853,6 +1854,9 @@ class Database: #FIXME: recognise currency return tmp[0] + def resetPlayerIDs(self): + self.pcache = None + def getSqlPlayerIDs(self, pnames, siteid): result = {} if(self.pcache == None): diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 27c5fd6d..ae05e171 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -409,6 +409,10 @@ class fpdb: # self.release_global_lock() # lock_released = True 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() #else: # for other dbs use same connection as holds global lock