Hand.insert() update - low hanging fruit

This commit is contained in:
Worros 2009-06-08 18:19:55 +08:00
parent 56f2112403
commit 4f555e2d8f
2 changed files with 29 additions and 6 deletions

View File

@ -92,16 +92,14 @@ db: a connected fpdb_db object"""
# HandsActions - all actions for all players for all streets - self.actions
# BoardCards - Skip - no longer necessary?
# Hands - Summary information of hand indexed by handId - gameinfo
# self.tablename = tableName
# self.handid = siteHandNo
hh['siteHandNo'] = self.handid
# gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
#
# self.starttime = handStart
# importTime DATETIME NOT NULL,
#
hh['handStart'] = self.starttime
# seats TINYINT NOT NULL,
#
# self.maxseats = maxSeats
hh['tableName'] = self.tablename
hh['maxSeats'] = self.maxseats
# boardcard1 smallint, /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
# boardcard2 smallint,
# boardcard3 smallint,
@ -141,6 +139,7 @@ db: a connected fpdb_db object"""
# showdownPot INT, /* pot size at sd/street7 */
# comment TEXT,
# commentTs DATETIME
handid = db.storeHand(hh)
# HandsPlayers - ? ... Do we fix winnings?
# Tourneys ?
# TourneysPlayers

View File

@ -241,3 +241,27 @@ class fpdb_db:
#We proabably want to cache this
return result
def storeHand(self, p):
#stores into table hands:
self.cursor.execute ("""INSERT INTO Hands
(siteHandNo, gametypeId, handStart, seats, tableName, importTime, maxSeats
,playersVpi, playersAtStreet1, playersAtStreet2
,playersAtStreet3, playersAtStreet4, playersAtShowdown
,street0Raises, street1Raises, street2Raises
,street3Raises, street4Raises, street1Pot
,street2Pot, street3Pot, street4Pot
,showdownPot
)
VALUES
(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
,(p['siteHandNo'], gametype_id, p['handStart'], len(names), p['tableName'], datetime.datetime.today(), p['maxSeats']
,hudCache['playersVpi'], hudCache['playersAtStreet1'], hudCache['playersAtStreet2']
,hudCache['playersAtStreet3'], hudCache['playersAtStreet4'], hudCache['playersAtShowdown']
,hudCache['street0Raises'], hudCache['street1Raises'], hudCache['street2Raises']
,hudCache['street3Raises'], hudCache['street4Raises'], hudCache['street1Pot']
,hudCache['street2Pot'], hudCache['street3Pot'], hudCache['street4Pot']
,hudCache['showdownPot']
)
)
#return getLastInsertId(backend, conn, cursor)