* implement the new SessionsCache table
- The SessionsCache table can be used to track overall or game sepecific sessions
- The totalProfit field is summed by gameTypeId for cash games allowing for multiple currencies
- Tournament profit (cashes - buy-ins) are also recorded in totalProfit and its grouped by tourneyId
* change the sequence and methodology surrounding the import of hands
- fpdb_import.py implements a unique Hand.py method for each table
- Hands SessionCache and HudCache records themselves are 'cached' to allow for 'bulk insert' at EOF
- import is reorganized to allow for efficient locking in multiple connection environments
* changes the name of the index created by addTPlayersIndex (so that it is unique) to accommodate a bug in MySQL 5.5
TODO
* A 'rebuild_sessionsCache' method is still required
* Further commits are expected to fix bugs created during the porting of this code
* Added a cacheSessions update call to import_file_dict() in fpdb_import.py
* Added updateSessionsCache() method to Hands
* Added storeSessionsCache() to Database --- WORK IN PROGRESS and set to pass
TO DOs
- add sessions queries to SQL
- complete storeSessionsCache() so it works like we've discussed (save for adding sessionId to HP)
- add SessionsCache keys
- add SessionsCache to the default table creation and deletion methods in Database.py
- update storeSessionsCache() and all the relevant db & sql code so it writes a sessionId to HP
setPrintTestData: Indicate you would like to print test data when importing
setFakeCacheHHC: Indicate you want to access the HHC after an import run
getCachedHHC: Retrieve HHC
Also modified the main import loop to pass self.settings['testData'] to the database insert and records the HHC if requested
Had a report on the 2+2 thread that:
File "C:\Documents and Settings\b\Desktop\fpdb\pyfpdb\GuiAutoImport.py", line 160, in do_import
self.importer.runUpdated()
File "C:\Documents and Settings\b\Desktop\fpdb\pyfpdb\fpdb_import.py", line 371, in runUpdated
(stored, duplicates, partial, errors, ttime) = self.import_file_dict(self.database, file, self.filelist[file][0], self.filelist[file][1], None)
File "C:\Documents and Settings\b\Desktop\fpdb\pyfpdb\fpdb_import.py", line 467, in import_file_dict
print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud
IOError: [Errno 9] Bad file descriptor
Was happening, which is a crash attempting to print self.caller.pipe_to_hud
This patch doesn't fix the problem, but should give some indication in the log that it happened.