hudcache is regenerated properly on mysql now

This commit is contained in:
steffen123 2010-08-11 00:10:10 +02:00
parent 36b212388d
commit 174aa4adfb
2 changed files with 32 additions and 5 deletions

View File

@ -1451,13 +1451,32 @@ class Database:
+ " or ( hp.playerId in " + str(tuple(self.hero_ids.values())) \
+ " and h.startTime > '" + h_start + "'))" \
+ " AND hp.tourneysPlayersId IS NULL)"
rebuild_sql_cash = self.sql.query['rebuildHudCache'].replace('<where_clause>', where)
print "rebuild_sql_cash:",rebuild_sql_cash
rebuild_sql_cash = self.sql.query['rebuildHudCache'].replace('<tourney1_clause>', "")
rebuild_sql_cash = rebuild_sql_cash.replace('<tourney2_clause>', "")
rebuild_sql_cash = rebuild_sql_cash.replace('<tourney_join_clause>', "")
rebuild_sql_cash = rebuild_sql_cash.replace('<tourney_group_clause>', "")
rebuild_sql_cash = rebuild_sql_cash.replace('<where_clause>', where)
#print "rebuild_sql_cash:",rebuild_sql_cash
self.get_cursor().execute(self.sql.query['clearHudCache'])
self.get_cursor().execute(rebuild_sql_cash)
#self.get_cursor().execute(rebuild_sql_tour)
if self.hero_ids == {}:
where = "WHERE hp.tourneysPlayersId >= 0"
else:
where = "where ((( hp.playerId not in " + str(tuple(self.hero_ids.values())) \
+ " and h.startTime > '" + v_start + "')" \
+ " or ( hp.playerId in " + str(tuple(self.hero_ids.values())) \
+ " and h.startTime > '" + h_start + "'))" \
+ " AND hp.tourneysPlayersId >= 0)"
rebuild_sql_tourney = self.sql.query['rebuildHudCache'].replace('<tourney1_clause>', ",tourneyTypeId")
rebuild_sql_tourney = rebuild_sql_tourney.replace('<tourney2_clause>', ",t.tourneyTypeId")
rebuild_sql_tourney = rebuild_sql_tourney.replace('<tourney_join_clause>', """INNER JOIN TourneysPlayers tp ON (tp.id = hp.tourneysPlayersId)
INNER JOIN Tourneys t ON (t.id = tp.tourneyId)""")
rebuild_sql_tourney = rebuild_sql_tourney.replace('<tourney_group_clause>', ",t.tourneyTypeId")
rebuild_sql_tourney = rebuild_sql_tourney.replace('<where_clause>', where)
#print "rebuild_sql_tourney:",rebuild_sql_tourney
self.get_cursor().execute(rebuild_sql_tourney)
self.commit()
print "Rebuild hudcache took %.1f seconds" % (time() - stime,)
except:

View File

@ -2990,6 +2990,7 @@ class Sql:
,playerId
,activeSeats
,position
<tourney1_clause>
,styleKey
,HDs
,wonWhenSeenStreet1
@ -3079,6 +3080,7 @@ class Sql:
when hp.position = '9' then 'E'
else 'E'
end AS hc_position
<tourney2_clause>
,date_format(h.startTime, 'd%y%m%d')
,count(1)
,sum(wonWhenSeenStreet1)
@ -3152,11 +3154,13 @@ class Sql:
,sum(hp.street4Raises)
FROM HandsPlayers hp
INNER JOIN Hands h ON (h.id = hp.handId)
<tourney_join_clause>
<where_clause>
GROUP BY h.gametypeId
,hp.playerId
,h.seats
,hc_position
<tourney_group_clause>
,date_format(h.startTime, 'd%y%m%d')
"""
elif db_server == 'postgresql':
@ -3342,6 +3346,7 @@ class Sql:
,playerId
,activeSeats
,position
<tourney1_clause>
,styleKey
,HDs
,wonWhenSeenStreet1
@ -3431,6 +3436,7 @@ class Sql:
when hp.position = '9' then 'E'
else 'E'
end AS hc_position
<tourney2_clause>
,'d' || substr(strftime('%Y%m%d', h.startTime),3,7)
,count(1)
,sum(wonWhenSeenStreet1)
@ -3504,11 +3510,13 @@ class Sql:
,sum(CAST(hp.street4Raises as integer))
FROM HandsPlayers hp
INNER JOIN Hands h ON (h.id = hp.handId)
<tourney_join_clause>
<where_clause>
GROUP BY h.gametypeId
,hp.playerId
,h.seats
,hc_position
<tourney_group_clause>
,'d' || substr(strftime('%Y%m%d', h.startTime),3,7)
"""