Merge branch 'chazdazzle' of git://github.com/ChazDazzle/fpdb-chaz

This commit is contained in:
Worros 2011-03-30 11:12:22 +08:00
commit 1e3bbd6047
8 changed files with 27 additions and 22 deletions

View File

@ -399,7 +399,12 @@ class Database:
if use_pool: if use_pool:
MySQLdb = pool.manage(MySQLdb, pool_size=5) MySQLdb = pool.manage(MySQLdb, pool_size=5)
try: try:
self.connection = MySQLdb.connect(host=host, user=user, passwd=password, db=database, use_unicode=True) self.connection = MySQLdb.connect(host=host
,user=user
,passwd=password
,db=database
,charset='utf8'
,use_unicode=True)
self.__connected = True self.__connected = True
#TODO: Add port option #TODO: Add port option
except MySQLdb.Error, ex: except MySQLdb.Error, ex:
@ -1885,7 +1890,7 @@ class Database:
if doinsert: if doinsert:
for h in hbulk: for h in hbulk:
id = h.pop() id = h.pop()
if (hdata['sc'] != None and hdata['sc']['bk']) and hdata['gsc']['bk']: if hdata['sc'] and hdata['gsc']:
h[4] = hdata['sc'][id]['id'] h[4] = hdata['sc'][id]['id']
h[5] = hdata['gsc'][id]['id'] h[5] = hdata['gsc'][id]['id']
q = self.sql.query['store_hand'] q = self.sql.query['store_hand']

View File

@ -44,10 +44,10 @@ class FullTiltPokerSummary(TourneySummary):
} }
substitutions = { substitutions = {
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
'LS' : "\$|\xe2\x82\xac|", # legal currency symbols - Euro(cp1252, utf-8) 'LS' : u"\$|\xe2\x82\xac|\u20ac|", # legal currency symbols - Euro(cp1252, utf-8)
'TAB' : u"-\u2013'\s\da-zA-Z", # legal characters for tablename 'TAB' : u"-\u2013'\s\da-zA-Z", # legal characters for tablename
'NUM' : u".,\d", # legal characters in number format 'NUM' : u".,\d", # legal characters in number format
} }
re_SplitTourneys = re.compile("^Full Tilt Poker Tournament Summary") re_SplitTourneys = re.compile("^Full Tilt Poker Tournament Summary")

View File

@ -306,9 +306,9 @@ dealt whether they were seen in a 'dealt to' line
sc = db.prepSessionsCache(self.dbid_hands, self.dbid_pids, self.startTime, sc, self.heros, doinsert) sc = db.prepSessionsCache(self.dbid_hands, self.dbid_pids, self.startTime, sc, self.heros, doinsert)
gsc = db.storeSessionsCache(self.dbid_hands, self.dbid_pids, self.startTime, self.gametype gsc = db.storeSessionsCache(self.dbid_hands, self.dbid_pids, self.startTime, self.gametype
,self.dbid_gt, self.handsplayers, sc, gsc, tz, self.heros, doinsert) ,self.dbid_gt, self.handsplayers, sc, gsc, tz, self.heros, doinsert)
if doinsert: if doinsert and sc['bk'] and gsc['bk']:
self.hands['sc'] = sc self.hands['sc'] = sc
self.hands['gsc'] = gsc self.hands['gsc'] = gsc
else: else:
self.hands['sc'] = None self.hands['sc'] = None
self.hands['gsc'] = None self.hands['gsc'] = None

View File

@ -41,8 +41,8 @@ class PacificPoker(HandHistoryConverter):
mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games
sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3", "play": ""} # ADD Euro, Sterling, etc HERE sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3", "play": ""} # ADD Euro, Sterling, etc HERE
substitutions = { substitutions = {
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8) 'LS' : u"\$|\xe2\x82\xac|\u20ac|" # legal currency symbols - Euro(cp1252, utf-8)
} }
# translations from captured groups to fpdb info strings # translations from captured groups to fpdb info strings

View File

@ -41,8 +41,8 @@ class PokerStars(HandHistoryConverter):
mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games mixes = { 'HORSE': 'horse', '8-Game': '8game', 'HOSE': 'hose'} # Legal mixed games
sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3", "play": ""} # ADD Euro, Sterling, etc HERE sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3", "play": ""} # ADD Euro, Sterling, etc HERE
substitutions = { substitutions = {
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
'LS' : u"\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8) 'LS' : u"\$|\xe2\x82\xac|\u20ac|" # legal currency symbols - Euro(cp1252, utf-8)
} }
# translations from captured groups to fpdb info strings # translations from captured groups to fpdb info strings

View File

@ -287,11 +287,11 @@ class Sql:
if db_server == 'mysql': if db_server == 'mysql':
self.query['createPlayersTable'] = """CREATE TABLE Players ( self.query['createPlayersTable'] = """CREATE TABLE Players (
id INT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id), id INT UNSIGNED AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
name VARCHAR(32) CHARACTER SET utf8 NOT NULL, name VARCHAR(32) NOT NULL,
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id), siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
comment text, comment text,
commentTs DATETIME) commentTs DATETIME)
ENGINE=INNODB""" ENGINE=INNODB"""
elif db_server == 'postgresql': elif db_server == 'postgresql':
self.query['createPlayersTable'] = """CREATE TABLE Players ( self.query['createPlayersTable'] = """CREATE TABLE Players (

View File

@ -44,8 +44,8 @@ class WinamaxSummary(TourneySummary):
} }
substitutions = { substitutions = {
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
'LS' : u"\$|\xe2\x82\xac|\u20AC|" # legal currency symbols 'LS' : u"\$|\xe2\x82\xac|\u20ac|" # legal currency symbols
} }
re_GameType = re.compile("""<h1>((?P<LIMIT>No Limit|Pot Limit) (?P<GAME>Hold\'em))</h1>""") re_GameType = re.compile("""<h1>((?P<LIMIT>No Limit|Pot Limit) (?P<GAME>Hold\'em))</h1>""")

View File

@ -54,8 +54,8 @@ class Winamax(HandHistoryConverter):
mixes = { } # Legal mixed games mixes = { } # Legal mixed games
sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3"} # ADD Euro, Sterling, etc HERE sym = {'USD': "\$", 'CAD': "\$", 'T$': "", "EUR": "\xe2\x82\xac", "GBP": "\xa3"} # ADD Euro, Sterling, etc HERE
substitutions = { substitutions = {
'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes 'LEGAL_ISO' : "USD|EUR|GBP|CAD|FPP", # legal ISO currency codes
'LS' : "\$|\xe2\x82\xac|" # legal currency symbols - Euro(cp1252, utf-8) 'LS' : u"\$|\xe2\x82\xac|\u20ac|" # legal currency symbols - Euro(cp1252, utf-8)
} }
limits = { 'no limit':'nl', 'pot limit' : 'pl','LIMIT':'fl'} limits = { 'no limit':'nl', 'pot limit' : 'pl','LIMIT':'fl'}