p76 - specify NOT NULL on almost all table columns to increase DB resilience against importer errors
little bugfix to make omaha work again
This commit is contained in:
parent
c963599b76
commit
54ff7b71f1
|
@ -13,7 +13,6 @@ update ebuild and ubuntu guide for HUD_config.xml
|
|||
implement stud HudCache
|
||||
implement storeHudCache for stud base
|
||||
|
||||
specify NOT NULL on almost all table columns
|
||||
store raw hand in db and write reimport function using the raw hand field
|
||||
make windows use correct language version of Appdata, e.g. Anwendungdaten. http://mail.python.org/pipermail/python-list/2005-September/341702.html
|
||||
|
||||
|
|
|
@ -385,8 +385,7 @@ class fpdb:
|
|||
"""Displays a tab with the main fpdb help screen"""
|
||||
#print "start of tab_main_help"
|
||||
mh_tab=gtk.Label("""Welcome to Fpdb!
|
||||
For howto information please see docs"""+os.sep+"""readme-user.txt
|
||||
The abbrevations in the table viewer are explained in docs"""+os.sep+"""abbrevations.txt
|
||||
For documentation please visit our website at http://fpdb.sourceforge.net/ or check the docs directory in the fpdb folder.
|
||||
This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||
self.add_and_display_tab(mh_tab, "Help")
|
||||
#end def tab_main_help
|
||||
|
@ -408,14 +407,14 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
|||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
self.window.connect("delete_event", self.delete_event)
|
||||
self.window.connect("destroy", self.destroy)
|
||||
self.window.set_title("Free Poker DB - version: alpha2+, p75")
|
||||
self.window.set_title("Free Poker DB - version: alpha2+, p76")
|
||||
self.window.set_border_width(1)
|
||||
self.window.set_size_request(1020,400)
|
||||
self.window.set_resizable(True)
|
||||
|
||||
self.menu_items = (
|
||||
( "/_Main", None, None, 0, "<Branch>" ),
|
||||
( "/Main/_Load Profile", "<control>L", self.dia_load_profile, 0, None ),
|
||||
( "/Main/_Load Profile (broken)", "<control>L", self.dia_load_profile, 0, None ),
|
||||
( "/Main/_Edit Profile (todo)", "<control>E", self.dia_edit_profile, 0, None ),
|
||||
( "/Main/_Save Profile (todo)", None, self.dia_save_profile, 0, None ),
|
||||
( "/Main/sep1", None, None, 0, "<Separator>" ),
|
||||
|
|
|
@ -48,7 +48,7 @@ class fpdb_db:
|
|||
try:
|
||||
self.cursor.execute("SELECT * FROM Settings")
|
||||
settings=self.cursor.fetchone()
|
||||
if settings[0]!=75:
|
||||
if settings[0]!=76:
|
||||
print "outdated or too new database version - please recreate tables"
|
||||
self.wrongDbVersion=True
|
||||
except:# _mysql_exceptions.ProgrammingError:
|
||||
|
@ -156,109 +156,110 @@ class fpdb_db:
|
|||
self.drop_tables()
|
||||
|
||||
self.create_table("""Settings (
|
||||
version SMALLINT)""")
|
||||
version SMALLINT NOT NULL)""")
|
||||
|
||||
self.create_table("""Sites (
|
||||
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
name varchar(32),
|
||||
currency char(3))""")
|
||||
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
name varchar(32) NOT NULL,
|
||||
currency char(3) NOT NULL)""")
|
||||
|
||||
self.create_table("""Gametypes (
|
||||
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
||||
type char(4),
|
||||
base char(4),
|
||||
category varchar(9),
|
||||
limitType char(2),
|
||||
hiLo char(1),
|
||||
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
||||
type char(4) NOT NULL,
|
||||
base char(4) NOT NULL,
|
||||
category varchar(9) NOT NULL,
|
||||
limitType char(2) NOT NULL,
|
||||
hiLo char(1) NOT NULL,
|
||||
smallBlind int,
|
||||
bigBlind int,
|
||||
smallBet int,
|
||||
bigBet int)""")
|
||||
smallBet int NOT NULL,
|
||||
bigBet int NOT NULL)""")
|
||||
#NOT NULL not set for small/bigBlind as they are not existent in all games
|
||||
|
||||
self.create_table("""Players (
|
||||
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
name VARCHAR(32) CHARACTER SET utf8,
|
||||
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
||||
id INT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
name VARCHAR(32) CHARACTER SET utf8 NOT NULL,
|
||||
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
||||
comment text,
|
||||
commentTs DATETIME)""")
|
||||
|
||||
self.create_table("""Autorates (
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||
description varchar(50),
|
||||
shortDesc char(8),
|
||||
ratingTime DATETIME,
|
||||
handCount int)""")
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||
description varchar(50) NOT NULL,
|
||||
shortDesc char(8) NOT NULL,
|
||||
ratingTime DATETIME NOT NULL,
|
||||
handCount int NOT NULL)""")
|
||||
|
||||
self.create_table("""Hands (
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
tableName VARCHAR(20),
|
||||
siteHandNo BIGINT,
|
||||
gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||
handStart DATETIME,
|
||||
importTime DATETIME,
|
||||
seats SMALLINT,
|
||||
maxSeats SMALLINT,
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
tableName VARCHAR(20) NOT NULL,
|
||||
siteHandNo BIGINT NOT NULL,
|
||||
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||
handStart DATETIME NOT NULL,
|
||||
importTime DATETIME NOT NULL,
|
||||
seats SMALLINT NOT NULL,
|
||||
maxSeats SMALLINT NOT NULL,
|
||||
comment TEXT,
|
||||
commentTs DATETIME)""")
|
||||
|
||||
self.create_table("""BoardCards (
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
|
||||
card1Value smallint,
|
||||
card1Suit char(1),
|
||||
card2Value smallint,
|
||||
card2Suit char(1),
|
||||
card3Value smallint,
|
||||
card3Suit char(1),
|
||||
card4Value smallint,
|
||||
card4Suit char(1),
|
||||
card5Value smallint,
|
||||
card5Suit char(1))""")
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
handId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handId) REFERENCES Hands(id),
|
||||
card1Value smallint NOT NULL,
|
||||
card1Suit char(1) NOT NULL,
|
||||
card2Value smallint NOT NULL,
|
||||
card2Suit char(1) NOT NULL,
|
||||
card3Value smallint NOT NULL,
|
||||
card3Suit char(1) NOT NULL,
|
||||
card4Value smallint NOT NULL,
|
||||
card4Suit char(1) NOT NULL,
|
||||
card5Value smallint NOT NULL,
|
||||
card5Suit char(1) NOT NULL)""")
|
||||
|
||||
self.create_table("""TourneyTypes (
|
||||
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
||||
buyin INT,
|
||||
fee INT,
|
||||
knockout INT,
|
||||
rebuyOrAddon BOOLEAN)""")
|
||||
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
siteId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (siteId) REFERENCES Sites(id),
|
||||
buyin INT NOT NULL,
|
||||
fee INT NOT NULL,
|
||||
knockout INT NOT NULL,
|
||||
rebuyOrAddon BOOLEAN NOT NULL)""")
|
||||
|
||||
self.create_table("""Tourneys (
|
||||
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
tourneyTypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
||||
siteTourneyNo BIGINT,
|
||||
entries INT,
|
||||
prizepool INT,
|
||||
startTime DATETIME,
|
||||
id INT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
||||
siteTourneyNo BIGINT NOT NULL,
|
||||
entries INT NOT NULL,
|
||||
prizepool INT NOT NULL,
|
||||
startTime DATETIME NOT NULL,
|
||||
comment TEXT,
|
||||
commentTs DATETIME)""")
|
||||
|
||||
self.create_table("""TourneysPlayers (
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
tourneyId INT UNSIGNED, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
|
||||
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
payinAmount INT,
|
||||
rank INT,
|
||||
winnings INT,
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
tourneyId INT UNSIGNED NOT NULL, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
|
||||
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
payinAmount INT NOT NULL,
|
||||
rank INT NOT NULL,
|
||||
winnings INT NOT NULL,
|
||||
comment TEXT,
|
||||
commentTs DATETIME)""")
|
||||
|
||||
self.create_table("""HandsPlayers (
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
|
||||
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
startCash INT,
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
handId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handId) REFERENCES Hands(id),
|
||||
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
startCash INT NOT NULL,
|
||||
position CHAR(1),
|
||||
seatNo SMALLINT,
|
||||
seatNo SMALLINT NOT NULL,
|
||||
ante INT,
|
||||
|
||||
card1Value smallint,
|
||||
card1Suit char(1),
|
||||
card2Value smallint,
|
||||
card2Suit char(1),
|
||||
card1Value smallint NOT NULL,
|
||||
card1Suit char(1) NOT NULL,
|
||||
card2Value smallint NOT NULL,
|
||||
card2Suit char(1) NOT NULL,
|
||||
card3Value smallint,
|
||||
card3Suit char(1),
|
||||
card4Value smallint,
|
||||
|
@ -270,99 +271,100 @@ class fpdb_db:
|
|||
card7Value smallint,
|
||||
card7Suit char(1),
|
||||
|
||||
winnings int,
|
||||
rake int,
|
||||
winnings int NOT NULL,
|
||||
rake int NOT NULL,
|
||||
comment text,
|
||||
commentTs DATETIME,
|
||||
|
||||
tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))""")
|
||||
#NOT NULL not set on cards 3-7 as they dont exist in all games
|
||||
|
||||
self.create_table("""HandsActions (
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
handPlayerId BIGINT UNSIGNED, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
|
||||
street SMALLINT,
|
||||
actionNo SMALLINT,
|
||||
action CHAR(5),
|
||||
amount INT,
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
handPlayerId BIGINT UNSIGNED NOT NULL, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
|
||||
street SMALLINT NOT NULL,
|
||||
actionNo SMALLINT NOT NULL,
|
||||
action CHAR(5) NOT NULL,
|
||||
amount INT NOT NULL,
|
||||
comment TEXT,
|
||||
commentTs DATETIME)""")
|
||||
|
||||
self.create_table("""HudCache (
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
|
||||
gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
activeSeats SMALLINT,
|
||||
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT NOT NULL, PRIMARY KEY (id),
|
||||
gametypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
|
||||
playerId INT UNSIGNED NOT NULL, FOREIGN KEY (playerId) REFERENCES Players(id),
|
||||
activeSeats SMALLINT NOT NULL,
|
||||
position CHAR(1),
|
||||
tourneyTypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
||||
tourneyTypeId SMALLINT UNSIGNED NOT NULL, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
|
||||
|
||||
HDs INT,
|
||||
street0VPI INT,
|
||||
street0Aggr INT,
|
||||
street0_3B4BChance INT,
|
||||
street0_3B4BDone INT,
|
||||
HDs INT NOT NULL,
|
||||
street0VPI INT NOT NULL,
|
||||
street0Aggr INT NOT NULL,
|
||||
street0_3B4BChance INT NOT NULL,
|
||||
street0_3B4BDone INT NOT NULL,
|
||||
|
||||
street1Seen INT,
|
||||
street2Seen INT,
|
||||
street3Seen INT,
|
||||
street4Seen INT,
|
||||
sawShowdown INT,
|
||||
street1Seen INT NOT NULL,
|
||||
street2Seen INT NOT NULL,
|
||||
street3Seen INT NOT NULL,
|
||||
street4Seen INT NOT NULL,
|
||||
sawShowdown INT NOT NULL,
|
||||
|
||||
street1Aggr INT,
|
||||
street2Aggr INT,
|
||||
street3Aggr INT,
|
||||
street4Aggr INT,
|
||||
street1Aggr INT NOT NULL,
|
||||
street2Aggr INT NOT NULL,
|
||||
street3Aggr INT NOT NULL,
|
||||
street4Aggr INT NOT NULL,
|
||||
|
||||
otherRaisedStreet1 INT,
|
||||
otherRaisedStreet2 INT,
|
||||
otherRaisedStreet3 INT,
|
||||
otherRaisedStreet4 INT,
|
||||
foldToOtherRaisedStreet1 INT,
|
||||
foldToOtherRaisedStreet2 INT,
|
||||
foldToOtherRaisedStreet3 INT,
|
||||
foldToOtherRaisedStreet4 INT,
|
||||
wonWhenSeenStreet1 FLOAT,
|
||||
wonAtSD FLOAT,
|
||||
otherRaisedStreet1 INT NOT NULL,
|
||||
otherRaisedStreet2 INT NOT NULL,
|
||||
otherRaisedStreet3 INT NOT NULL,
|
||||
otherRaisedStreet4 INT NOT NULL,
|
||||
foldToOtherRaisedStreet1 INT NOT NULL,
|
||||
foldToOtherRaisedStreet2 INT NOT NULL,
|
||||
foldToOtherRaisedStreet3 INT NOT NULL,
|
||||
foldToOtherRaisedStreet4 INT NOT NULL,
|
||||
wonWhenSeenStreet1 FLOAT NOT NULL,
|
||||
wonAtSD FLOAT NOT NULL,
|
||||
|
||||
stealAttemptChance INT,
|
||||
stealAttempted INT,
|
||||
foldBbToStealChance INT,
|
||||
foldedBbToSteal INT,
|
||||
foldSbToStealChance INT,
|
||||
foldedSbToSteal INT,
|
||||
stealAttemptChance INT NOT NULL,
|
||||
stealAttempted INT NOT NULL,
|
||||
foldBbToStealChance INT NOT NULL,
|
||||
foldedBbToSteal INT NOT NULL,
|
||||
foldSbToStealChance INT NOT NULL,
|
||||
foldedSbToSteal INT NOT NULL,
|
||||
|
||||
street1CBChance INT,
|
||||
street1CBDone INT,
|
||||
street2CBChance INT,
|
||||
street2CBDone INT,
|
||||
street3CBChance INT,
|
||||
street3CBDone INT,
|
||||
street4CBChance INT,
|
||||
street4CBDone INT,
|
||||
street1CBChance INT NOT NULL,
|
||||
street1CBDone INT NOT NULL,
|
||||
street2CBChance INT NOT NULL,
|
||||
street2CBDone INT NOT NULL,
|
||||
street3CBChance INT NOT NULL,
|
||||
street3CBDone INT NOT NULL,
|
||||
street4CBChance INT NOT NULL,
|
||||
street4CBDone INT NOT NULL,
|
||||
|
||||
foldToStreet1CBChance INT,
|
||||
foldToStreet1CBDone INT,
|
||||
foldToStreet2CBChance INT,
|
||||
foldToStreet2CBDone INT,
|
||||
foldToStreet3CBChance INT,
|
||||
foldToStreet3CBDone INT,
|
||||
foldToStreet4CBChance INT,
|
||||
foldToStreet4CBDone INT,
|
||||
foldToStreet1CBChance INT NOT NULL,
|
||||
foldToStreet1CBDone INT NOT NULL,
|
||||
foldToStreet2CBChance INT NOT NULL,
|
||||
foldToStreet2CBDone INT NOT NULL,
|
||||
foldToStreet3CBChance INT NOT NULL,
|
||||
foldToStreet3CBDone INT NOT NULL,
|
||||
foldToStreet4CBChance INT NOT NULL,
|
||||
foldToStreet4CBDone INT NOT NULL,
|
||||
|
||||
totalProfit INT,
|
||||
totalProfit INT NOT NULL,
|
||||
|
||||
street1CheckCallRaiseChance INT,
|
||||
street1CheckCallRaiseDone INT,
|
||||
street2CheckCallRaiseChance INT,
|
||||
street2CheckCallRaiseDone INT,
|
||||
street3CheckCallRaiseChance INT,
|
||||
street3CheckCallRaiseDone INT,
|
||||
street4CheckCallRaiseChance INT,
|
||||
street4CheckCallRaiseDone INT)""")
|
||||
street1CheckCallRaiseChance INT NOT NULL,
|
||||
street1CheckCallRaiseDone INT NOT NULL,
|
||||
street2CheckCallRaiseChance INT NOT NULL,
|
||||
street2CheckCallRaiseDone INT NOT NULL,
|
||||
street3CheckCallRaiseChance INT NOT NULL,
|
||||
street3CheckCallRaiseDone INT NOT NULL,
|
||||
street4CheckCallRaiseChance INT NOT NULL,
|
||||
street4CheckCallRaiseDone INT NOT NULL)""")
|
||||
|
||||
self.cursor.execute("INSERT INTO Settings VALUES (75);")
|
||||
self.cursor.execute("INSERT INTO Settings VALUES (76);")
|
||||
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');")
|
||||
self.cursor.execute("INSERT INTO Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
|
||||
self.cursor.execute("INSERT INTO TourneyTypes (id) VALUES (DEFAULT);")
|
||||
self.cursor.execute("INSERT INTO TourneyTypes VALUES (DEFAULT, 1, 0, 0, 0, False);")
|
||||
self.db.commit()
|
||||
print "finished recreating tables"
|
||||
#end def recreate_tables
|
||||
|
|
|
@ -1192,8 +1192,8 @@ def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids, sta
|
|||
(hands_id, player_ids[i], start_cashes[i], positions[i],
|
||||
card_values[i][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
|
||||
card_values[i][2], card_suits[i][2], card_values[i][3], card_suits[i][3],
|
||||
winnings[i], rakes[i], seatNo[i]))
|
||||
cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i]))
|
||||
winnings[i], rakes[i], seatNos[i]))
|
||||
cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
|
||||
result.append(cursor.fetchall()[0][0])
|
||||
else:
|
||||
raise FpdbError("invalid category")
|
||||
|
|
Loading…
Reference in New Issue
Block a user