diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py
index 691adae9..266a1c04 100755
--- a/pyfpdb/fpdb.py
+++ b/pyfpdb/fpdb.py
@@ -243,6 +243,24 @@ class fpdb:
#if not lock_released:
self.release_global_lock()
#end def dia_recreate_tables
+
+ def dia_recreate_hudcache(self, widget, data=None):
+ if self.obtain_global_lock():
+ try:
+ dia_confirm = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm recreating HUD cache")
+ diastring = "Please confirm that you want to re-create the HUD cache."
+ dia_confirm.format_secondary_text(diastring)
+
+ response = dia_confirm.run()
+ dia_confirm.destroy()
+ if response == gtk.RESPONSE_YES:
+ self.db.rebuild_hudcache()
+ elif response == gtk.REPSONSE_NO:
+ print 'User cancelled rebuilding hud cache'
+ except:
+ pass
+ self.release_global_lock()
+
def dia_regression_test(self, widget, data=None):
print "todo: implement dia_regression_test"
@@ -306,6 +324,7 @@ class fpdb:
+
@@ -344,6 +363,7 @@ class fpdb:
('createdb', None, 'Create or Delete _Database (todo)', None, 'Create or Delete Database', self.dia_create_del_database),
('createuser', None, 'Create or Delete _User (todo)', None, 'Create or Delete User', self.dia_create_del_user),
('createtabs', None, 'Create or Recreate _Tables', None, 'Create or Recreate Tables ', self.dia_recreate_tables),
+ ('rebuildhudcache', None, 'Rebuild HUD Cache', None, 'Rebuild HUD Cache', self.dia_recreate_hudcache),
('stats', None, '_Statistics (todo)', None, 'View Database Statistics', self.dia_database_stats),
('sessions', None, 'Sessions', None, 'View Sessions', self.dia_database_sessions),
('help', None, '_Help'),
diff --git a/pyfpdb/fpdb_db.py b/pyfpdb/fpdb_db.py
index 99724d7e..a08d45b0 100644
--- a/pyfpdb/fpdb_db.py
+++ b/pyfpdb/fpdb_db.py
@@ -356,6 +356,10 @@ class fpdb_db:
"""Drop some indexes/foreign keys to prepare for bulk import.
Currently keeping the standalone indexes as needed to import quickly"""
stime = time()
+ if self.backend == self.MYSQL_INNODB:
+ self.cursor.execute("SET foreign_key_checks=0")
+ self.cursor.execute("SET autocommit=0")
+ return
if self.backend == self.PGSQL:
self.db.set_isolation_level(0) # allow table/index operations to work
for fk in self.foreignKeys[self.backend]:
@@ -445,6 +449,12 @@ class fpdb_db:
def afterBulkImport(self):
"""Re-create any dropped indexes/foreign keys after bulk import"""
stime = time()
+
+ if self.backend == self.MYSQL_INNODB:
+ self.cursor.execute("SET foreign_key_checks=1")
+ self.cursor.execute("SET autocommit=1")
+ return
+
if self.backend == self.PGSQL:
self.db.set_isolation_level(0) # allow table/index operations to work
for fk in self.foreignKeys[self.backend]: