Merge branch 'master' of git://git.assembla.com/fpdb-eric

This commit is contained in:
sqlcoder
2009-07-28 21:25:07 +01:00
8 changed files with 118 additions and 54 deletions
+10
View File
@@ -361,6 +361,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]:
@@ -450,6 +454,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]: