Modified import_file_dict() so that it stores HandsPlayers and HandsActions inserts in a temprorary list. Once the end of the handlist is reached, an executemany() bulk insert is done.

This commit is contained in:
chaz@pokeit.co
2011-01-01 15:40:06 -05:00
parent 990e226254
commit 38e6e15a26
4 changed files with 34 additions and 20 deletions
+8 -1
View File
@@ -473,12 +473,19 @@ class Importer:
handlist = hhc.getProcessedHands()
self.pos_in_file[file] = hhc.getLastCharacterRead()
to_hud = []
hp_bulk = []
ha_bulk = []
i = 0
for hand in handlist:
if hand is not None:
hand.prepInsert(self.database)
try:
hand.insert(self.database, printtest = self.settings['testData'])
hp_inserts, ha_inserts = hand.insert(self.database, hp_data = hp_bulk,
ha_data = ha_bulk, insert_data = len(handlist)==i,
printtest = self.settings['testData'])
hp_bulk += hp_inserts
ha_bulk += ha_inserts
except Exceptions.FpdbHandDuplicate:
duplicates += 1
else: