git35 - changed table and field names to match my naming convention to stabilise downstream-facing api.

This commit is contained in:
steffen123 2008-08-15 01:45:40 +01:00
parent e56a65b4c9
commit 341b24a2e0
7 changed files with 321 additions and 398 deletions

View File

@ -3,6 +3,7 @@ Everything is subject to change and especially the order will often change. Patc
alpha2 (release by 17Aug) alpha2 (release by 17Aug)
====== ======
move version into seperate file for fpdb gui and db
printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring-successful-steal-by-cutoff.txt and ps-lhe-ring-call-3B-preflop-cb-no2b.txt printhand each and the 2/3 relevant printplayerflags respectively on ps-lhe-ring-successful-steal-by-cutoff.txt and ps-lhe-ring-call-3B-preflop-cb-no2b.txt
auto-import auto-import
seperate and improve instructions for update seperate and improve instructions for update

View File

@ -20,7 +20,7 @@ Copyright 2008 Steffen Jobbagy-Felso<br>
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in fdl-1.2.txt<br> Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license can be found in fdl-1.2.txt<br>
The program itself is licensed under AGPLv3, see agpl-3.0.txt</p> The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<p>See readme.txt for copying</P> <p>See readme.txt for copying</P>
<p><B>Table settings</B></P> <p><B>Table Settings</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>Field name</P></TD> <TD><P>Field name</P></TD>
@ -33,8 +33,7 @@ The program itself is licensed under AGPLv3, see agpl-3.0.txt</p>
<TD><P>the git version of the database (ie. table design changes and major bugfixes require a bump)</P></TD> <TD><P>the git version of the database (ie. table design changes and major bugfixes require a bump)</P></TD>
</TR> </TR>
</TABLE> </TABLE>
<p><B>Table <p><B>Table Players</B></P>
players</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>Field name</P></TD> <TD><P>Field name</P></TD>
@ -52,9 +51,9 @@ players</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>site_id</P></TD> <TD><P>siteId</P></TD>
<TD><P>smallint</P></TD> <TD><P>smallint</P></TD>
<TD><P>references sites.id</P></TD> <TD><P>references Sites.id</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>comment</P></TD> <TD><P>comment</P></TD>
@ -62,14 +61,13 @@ players</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>comment_ts</P></TD> <TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD> <TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR></P> <p><BR></P>
<p><B>Table <p><B>Table Autorates</B></P>
autorates</B></P>
<p>An autorating is a computer-&quot;recognised&quot; label/category for a player. Examples could include &quot;Calling Station&quot; if a player has &lt;20% each for aggression and folding postflop. Or &quot;Tight-Aggressive/Aggressive&quot; for players with &lt;20% VPIP, &gt;10% PFR and &gt;40% postflop aggression.</P> <p>An autorating is a computer-&quot;recognised&quot; label/category for a player. Examples could include &quot;Calling Station&quot; if a player has &lt;20% each for aggression and folding postflop. Or &quot;Tight-Aggressive/Aggressive&quot; for players with &lt;20% VPIP, &gt;10% PFR and &gt;40% postflop aggression.</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
@ -83,14 +81,14 @@ autorates</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>player_id</P></TD> <TD><P>playerId</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P>references players.id</P></TD> <TD><P>references Players.id</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>gametype_id</P></TD> <TD><P>gametypeId</P></TD>
<TD><P>smallint</P></TD> <TD><P>smallint</P></TD>
<TD><P>references gametypes.id</P></TD> <TD><P>references Gametypes.id</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>description</P></TD> <TD><P>description</P></TD>
@ -98,23 +96,23 @@ autorates</B></P>
<TD><P>autorating description</P></TD> <TD><P>autorating description</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>short_desc</P></TD> <TD><P>shortDesc</P></TD>
<TD><P>char(8)</P></TD> <TD><P>char(8)</P></TD>
<TD><P>short description e.g. for display in HUD</P></TD> <TD><P>short description e.g. for display in HUD</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>rating_time</P></TD> <TD><P>ratingTime</P></TD>
<TD><P>datetime (in UTC)</P></TD> <TD><P>datetime (in UTC)</P></TD>
<TD><P>timestamp of rating</P></TD> <TD><P>timestamp of rating</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>hand_count</P></TD> <TD><P>handCount</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P>number of hands rating is based on</P></TD> <TD><P>number of hands rating is based on</P></TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR></P> <p><BR></P>
<p><B>Table gametypes</B></P> <p><B>Table Gametypes</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>Field name</P></TD> <TD><P>Field name</P></TD>
@ -127,7 +125,7 @@ autorates</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>site_id</P></TD> <TD><P>siteId</P></TD>
<TD><P>smallint</P></TD> <TD><P>smallint</P></TD>
<TD><P>references sites.id</P></TD> <TD><P>references sites.id</P></TD>
</TR> </TR>
@ -150,7 +148,7 @@ autorates</B></P>
studhl=7 Card Stud 8 orbetter</p></TD> studhl=7 Card Stud 8 orbetter</p></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>limit_type</P></TD> <TD><P>limitType</P></TD>
<TD><P>char(2)</P></TD> <TD><P>char(2)</P></TD>
<TD><p>nl=No Limit<br> <TD><p>nl=No Limit<br>
cn=Cap No Limit<br> cn=Cap No Limit<br>
@ -159,28 +157,28 @@ autorates</B></P>
fl=Fixed Limit</P></TD> fl=Fixed Limit</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>small_blind</P></TD> <TD><P>smallBlind</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>big_blind</P></TD> <TD><P>bigBlind</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>small_bet</P></TD> <TD><P>smallBet</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>big_bet</P></TD> <TD><P>bigBet</P></TD>
<TD><P>int</P></TD> <TD><P>int</P></TD>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR></P> <p><BR></P>
<p><B>Table sites</B></P> <p><B>Table Sites</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>Field name</P></TD> <TD><P>Field name</P></TD>
@ -204,7 +202,7 @@ autorates</B></P>
</TR> </TR>
</TABLE> </TABLE>
<p><BR></P> <p><BR></P>
<p><B>Table hands</B></P> <p><B>Table Hands</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>Field Name</P></TD> <TD><P>Field Name</P></TD>
@ -217,17 +215,17 @@ autorates</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>site_hand_no</P></TD> <TD><P>siteHandNo</P></TD>
<TD><P>bigint</P></TD> <TD><P>bigint</P></TD>
<TD><P>the site's hand number</P></TD> <TD><P>the site's hand number</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>gametype_id</P></TD> <TD><P>gametypeId</P></TD>
<TD><P>smallint</P></TD> <TD><P>smallint</P></TD>
<TD><P>references gametypes.id</P></TD> <TD><P>references gametypes.id</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>hand_start</P></TD> <TD><P>handStart</P></TD>
<TD><P>datetime (in UTC)</P></TD> <TD><P>datetime (in UTC)</P></TD>
<TD><P>start date&amp;time of the hand</P></TD> <TD><P>start date&amp;time of the hand</P></TD>
</TR> </TR>
@ -242,145 +240,119 @@ autorates</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>comment_ts</P></TD> <TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD> <TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR></P> <p><BR></P>
<p><B>Table board_cards</B></P> <p><B>Table BoardCards</B></P>
<p>cardX -&gt; can be 1 through 5</P> <p>cardX -&gt; can be 1 through 5</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>Field Name</P></TD>
<P>Field Name</P> <TD><P>Type</P></TD>
</TD> <TD><P>Comment</P></TD>
<TD>
<P>Type</P>
</TD>
<TD>
<P>Comment</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>id</P></TD>
<P>id</P> <TD><P>bigint</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>bigint</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>handId</P></TD>
<P>hand_id</P> <TD><P>bigint</P></TD>
</TD> <TD><P>the site's hand number</P></TD>
<TD>
<P>bigint</P>
</TD>
<TD>
<P>the site's hand number</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>cardXValue</P></TD>
<P>cardX_value</P> <TD><P>smallint</P></TD>
</TD> <TD><P>2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x</P></TD>
<TD>
<P>smallint</P>
</TD>
<TD>
<P>2-10=2-10, J=11, Q=12,
K=13, A=14 (even in razz), unknown/no card=x</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>cardXSuit</P></TD>
<P>cardX_suit</P> <TD><P>char(1)</P></TD>
</TD> <TD><P>h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x</P></TD>
<TD>
<P>char(1)</P>
</TD>
<TD>
<P>h=hearts, s=spades,
d=diamonds, c=clubs, unknown/no card=x</P>
</TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR> <p><BR></P>
</P> <p><B>Table HandsPlayers</B></P>
<p><B>Table hands_players</B></P>
<p>cardX: can be 1 through 7, one for each card. In holdem/omaha this stores the hole cards so 3-7 or 5-7 are empty</P> <p>cardX: can be 1 through 7, one for each card. In holdem/omaha this stores the hole cards so 3-7 or 5-7 are empty</P>
<p>I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.</P> <p>I did not separate this into an extra table because I felt the lost space is not sufficiently large. Also the benefit for searching is far less relevant.</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP><TD><P>Field Name</P></TD><TD><P>Type</P></TD><TD><P>Comment</P></TD></TR> <TR VALIGN=TOP>
<TR VALIGN=TOP><TD><P>id</P></TD><TD><P>bigint</P></TD><TD><P><BR></P></TD></TR> <TD><P>Field Name</P></TD>
<TR VALIGN=TOP><TD><P>hand_id</P></TD><TD><P>bigint</P></TD><TD><P>references hands_stud.id</P></TD></TR> <TD><P>Type</P></TD><TD>
<TR VALIGN=TOP><TD><P>player_id</P></TD><TD><P>int</P></TD><TD><P>references players.id</P></TD></TR> <P>Comment</P></TD>
<TR VALIGN=TOP><TD><P>player_startcash</P></TD><TD><P>int</P></TD><TD><P><BR></P></TD></TR> </TR>
<TR VALIGN=TOP><TD><P>position</P></TD><TD><P>char(1)</P></TD> <TR VALIGN=TOP>
<TD><P>id</P></TD>
<TD><P>bigint</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>handId</P></TD>
<TD><P>bigint</P></TD>
<TD><P>references Hands.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>playerId</P></TD>
<TD><P>int</P></TD>
<TD><P>references Players.id</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>startCash</P></TD>
<TD><P>int</P></TD>
<TD><P><BR></P></TD></TR>
<TR VALIGN=TOP>
<TD><P>position</P></TD>
<TD><P>char(1)</P></TD>
<TD><p>BB=B, SB=S, Button=0, Cutoff=1, etc.</P> <TD><p>BB=B, SB=S, Button=0, Cutoff=1, etc.</P>
<P>This is used in holdem/omaha only.</P></TD></TR> <P>This is used in holdem/omaha only.</P></TD>
<TR VALIGN=TOP><TD><P>ante</P></TD><TD><P>int</P></TD><TD><P>note: for cash this couldbe boolean, but in tourneys you may enter a hand with less thanthe full ante</P></TD></TR> </TR>
<TR VALIGN=TOP><TD><P>cardX_value</P></TD><TD><P>smallint</P></TD> <TR VALIGN=TOP>
<TD><P>ante</P></TD>
<TD><P>int</P></TD>
<TD><P>note: for cash this could be boolean, but in tourneys you may enter a hand with less than the full ante</P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>cardXValue</P></TD>
<TD><P>smallint</P></TD>
<TD><p>2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x</P> <TD><p>2-10=2-10, J=11, Q=12, K=13, A=14 (even in razz), unknown/no card=x</P>
<P>see note above table</P></TD></TR> <P>see note above table</P></TD>
<TR VALIGN=TOP><TD><P>cardX_suit</P></TD><TD><P>char(1)</P></TD><TD><P>h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x</P></TD></TR>
<TR VALIGN=TOP><TD><P>winnings</P></TD><TD><P>int</P></TD><TD><P>winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is)</P></TD></TR>
<TR VALIGN=TOP>
<TD>
<P>rake</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>rake for this player for
this hand</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>cardXSuit</P></TD>
<P>comment</P> <TD><P>char(1)</P></TD>
</TD> <TD><P>h=hearts, s=spades, d=diamonds, c=clubs, unknown/no card=x</P></TD>
<TD>
<P>text</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>winnings</P></TD>
<P>comment_ts</P> <TD><P>int</P></TD>
</TD> <TD><P>winnings in this hand (bets, antes, etc. are NOT deducted, but rake already is)</P></TD>
<TD>
<P>datetime (in UTC)</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>rake</P></TD>
<P>tourneys_players_id</P> <TD><P>int</P></TD>
</TD> <TD><P>rake for this player for this hand</P></TD>
<TD> </TR>
<P>bigint</P> <TR VALIGN=TOP>
</TD> <TD><P>comment</P></TD>
<TD> <TD><P>text</P></TD>
<P>references <TD><P><BR></P></TD>
tourneys_players.id</P> </TR>
</TD> <TR VALIGN=TOP>
<TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD>
</TR>
<TR VALIGN=TOP>
<TD><P>tourneysPlayersId</P></TD>
<TD><P>bigint</P></TD>
<TD><P>references TourneysPlayers.id</P></TD>
</TR> </TR>
</TABLE> </TABLE>
<p><BR> <p><BR></P>
</P>
<P><B>Table HudDataHoldemOmaha</B></P> <P><B>Table HudDataHoldemOmaha</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
@ -573,7 +545,7 @@ autorates</B></P>
</TR> </TR>
</TABLE> </TABLE>
<P></P> <P></P>
<P><B>Table hands_actions</B></P> <P><B>Table HandsActions</B></P>
<p>Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.</P> <p>Did separate this into an extra table because it makes SELECTing across different streets so much easier. Also the space saving will be very large.</P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
@ -587,9 +559,9 @@ autorates</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>hand_player_id</P></TD> <TD><P>handPlayerId</P></TD>
<TD><P>bigint</P></TD> <TD><P>bigint</P></TD>
<TD><P>references hands_players.id</P></TD> <TD><P>references HandsPlayers.id</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>street</P></TD> <TD><P>street</P></TD>
@ -597,7 +569,7 @@ autorates</B></P>
<TD><p>street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud</P><P>-1 for seen showdown</P></TD> <TD><p>street number, 0-3 (preflop, flop, turn, river) for holdem/omaha or 0-4 for razz/stud</P><P>-1 for seen showdown</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>action_no</P></TD> <TD><P>actionNo</P></TD>
<TD><P>smallint</P></TD> <TD><P>smallint</P></TD>
<TD><P>action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)<br> <TD><P>action number, this is counted from zero for each street but across all players (e.g. in a heads up where the SB calls and the BB raises and the SB calls again would have numbers 0 and 1 for blinds, 2 and 4 for call and 3 for bet)<br>
Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0</P></TD> Note that the blinds are counted as an action, so if the SB stays in the hand it'll always be action #0</P></TD>
@ -619,7 +591,7 @@ autorates</B></P>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD><P>comment_ts</P></TD> <TD><P>commentTs</P></TD>
<TD><P>datetime (in UTC)</P></TD> <TD><P>datetime (in UTC)</P></TD>
<TD><P><BR></P></TD> <TD><P><BR></P></TD>
</TR> </TR>
@ -627,53 +599,27 @@ autorates</B></P>
<p><BR></P> <p><BR></P>
<p><B>Tournament Tables</B></P> <p><B>Tournament Tables</B></P>
<p><BR></P> <p><BR></P>
<p><B>Table tourneys</B></P> <p><B>Table Tourneys</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>Field name</P></TD>
<P>Field name</P> <TD><P>Type</P></TD>
</TD> <TD><P>Comment</P></TD>
<TD>
<P>Type</P>
</TD>
<TD>
<P>Comment</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>id</P></TD>
<P>id</P> <TD><P>int</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>int</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>siteId</P></TD>
<P>site_id</P> <TD><P>smallint</P></TD>
</TD> <TD><P>References Sites.id</P></TD>
<TD>
<P>smallint</P>
</TD>
<TD>
<P>References sites.id</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>siteTourneyNo</P></TD>
<P>site_tourney_no</P> <TD><P>bigint</P></TD>
</TD> <TD><P><BR></P></TD>
<TD>
<P>bigint</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD>
@ -683,8 +629,7 @@ autorates</B></P>
<P>int</P> <P>int</P>
</TD> </TD>
<TD> <TD>
<P>Buy-in in cents. Without <P>Buy-in in cents. Without rebuy/add-on</P>
rebuy/add-on</P>
</TD> </TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
@ -737,7 +682,7 @@ autorates</B></P>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD>
<P>start_time</P> <P>startTime</P>
</TD> </TD>
<TD> <TD>
<P>datetime (in UTC)</P> <P>datetime (in UTC)</P>
@ -760,7 +705,7 @@ autorates</B></P>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD>
<P>comment_ts</P> <P>commentTs</P>
</TD> </TD>
<TD> <TD>
<P>datetime (in UTC)</P> <P>datetime (in UTC)</P>
@ -773,67 +718,43 @@ autorates</B></P>
</TABLE> </TABLE>
<p><BR> <p><BR>
</P> </P>
<p><B>Table <p><B>Table TourneysPlayers</B></P>
tourneys_players</B></P>
<TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0> <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=0>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD><P>Field Name</P></TD>
<P>Field Name</P> <TD><P>Type</P></TD>
</TD> <TD><P>Comment</P></TD>
<TD> </TR>
<P>Type</P> <TR VALIGN=TOP>
</TD> <TD><P>id</P></TD>
<TD> <TD><P>bigint</P></TD>
<P>Comment</P> <TD><P><BR></P></TD>
</TD> </TR>
<TR VALIGN=TOP>
<TD><P>tourneyId</P></TD>
<TD><P>int</P></TD>
<TD><P>References Tourneys.id</P></TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD>
<P>id</P> <P>playerId</P>
</TD>
<TD>
<P>bigint</P>
</TD>
<TD>
<P><BR>
</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>tourney_id</P>
</TD> </TD>
<TD> <TD>
<P>int</P> <P>int</P>
</TD> </TD>
<TD> <TD>
<P>References tourneys.id</P> <P>References Players.id</P>
</TD> </TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD>
<P>player_id</P> <P>payinAmount</P>
</TD> </TD>
<TD> <TD>
<P>int</P> <P>int</P>
</TD> </TD>
<TD> <TD>
<P>References players.id</P> <P>Buyin, fee, rebuys and add-ons</P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD>
<P>payin_amount</P>
</TD>
<TD>
<P>int</P>
</TD>
<TD>
<P>Buyin, fee, rebuys and
add-ons</P>
</TD> </TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
@ -855,8 +776,7 @@ tourneys_players</B></P>
<P>signed int</P> <P>signed int</P>
</TD> </TD>
<TD> <TD>
<P>Winnings (not profit) by <P>Winnings (not profit) by this player, -1 if unknown.</P>
this player, -1 if unknown.</P>
</TD> </TD>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
@ -873,14 +793,13 @@ tourneys_players</B></P>
</TR> </TR>
<TR VALIGN=TOP> <TR VALIGN=TOP>
<TD> <TD>
<P>comment_ts</P> <P>commentTs</P>
</TD> </TD>
<TD> <TD>
<P>datetime (in UTC)</P> <P>datetime (in UTC)</P>
</TD> </TD>
<TD> <TD>
<P><BR> <P><BR></P>
</P>
</TD> </TD>
</TR> </TR>
</TABLE> </TABLE>

View File

@ -347,7 +347,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy) self.window.connect("destroy", self.destroy)
self.window.set_title("Free Poker DB - version: alpha1+, git34") self.window.set_title("Free Poker DB - version: alpha1+, git35")
self.window.set_border_width(1) self.window.set_border_width(1)
self.window.set_size_request(950,400) self.window.set_size_request(950,400)
self.window.set_resizable(True) self.window.set_resizable(True)

View File

@ -45,9 +45,9 @@ class fpdb_db:
raise fpdb_simple.FpdbError("unrecognised database backend:"+backend) raise fpdb_simple.FpdbError("unrecognised database backend:"+backend)
self.cursor=self.db.cursor() self.cursor=self.db.cursor()
try: try:
self.cursor.execute("SELECT * FROM settings") self.cursor.execute("SELECT * FROM Settings")
settings=self.cursor.fetchone() settings=self.cursor.fetchone()
if settings[0]!=33: if settings[0]!=35:
print "outdated database version - please recreate tables" print "outdated database version - please recreate tables"
except:# _mysql_exceptions.ProgrammingError: except:# _mysql_exceptions.ProgrammingError:
print "failed to read settings table - please recreate tables" print "failed to read settings table - please recreate tables"
@ -86,30 +86,43 @@ class fpdb_db:
def drop_tables(self): def drop_tables(self):
"""Drops the fpdb tables from the current db""" """Drops the fpdb tables from the current db"""
self.cursor.execute("DROP TABLE IF EXISTS settings;") #todo: run the below if current db is git34 or lower
#self.cursor.execute("DROP TABLE IF EXISTS settings;")
#self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
#self.cursor.execute("DROP TABLE IF EXISTS autorates;")
#self.cursor.execute("DROP TABLE IF EXISTS board_cards;")
#self.cursor.execute("DROP TABLE IF EXISTS hands_actions;")
#self.cursor.execute("DROP TABLE IF EXISTS hands_players;")
#self.cursor.execute("DROP TABLE IF EXISTS hands;")
#self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;")
#self.cursor.execute("DROP TABLE IF EXISTS tourneys;")
#self.cursor.execute("DROP TABLE IF EXISTS players;")
#self.cursor.execute("DROP TABLE IF EXISTS gametypes;")
#self.cursor.execute("DROP TABLE IF EXISTS sites;")
self.cursor.execute("DROP TABLE IF EXISTS Settings;")
self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;") self.cursor.execute("DROP TABLE IF EXISTS HudDataHoldemOmaha;")
self.cursor.execute("DROP TABLE IF EXISTS autorates;") self.cursor.execute("DROP TABLE IF EXISTS Autorates;")
self.cursor.execute("DROP TABLE IF EXISTS board_cards;") self.cursor.execute("DROP TABLE IF EXISTS BoardCards;")
self.cursor.execute("DROP TABLE IF EXISTS hands_actions;") self.cursor.execute("DROP TABLE IF EXISTS HandsActions;")
self.cursor.execute("DROP TABLE IF EXISTS hands_players;") self.cursor.execute("DROP TABLE IF EXISTS HandsPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS hands;") self.cursor.execute("DROP TABLE IF EXISTS Hands;")
self.cursor.execute("DROP TABLE IF EXISTS tourneys_players;") self.cursor.execute("DROP TABLE IF EXISTS TourneysPlayers;")
self.cursor.execute("DROP TABLE IF EXISTS tourneys;") self.cursor.execute("DROP TABLE IF EXISTS Tourneys;")
self.cursor.execute("DROP TABLE IF EXISTS players;") self.cursor.execute("DROP TABLE IF EXISTS Players;")
self.cursor.execute("DROP TABLE IF EXISTS gametypes;") self.cursor.execute("DROP TABLE IF EXISTS Gametypes;")
self.cursor.execute("DROP TABLE IF EXISTS sites;") self.cursor.execute("DROP TABLE IF EXISTS Sites;")
self.db.commit() self.db.commit()
#end def drop_tables #end def drop_tables
def get_backend_name(self): def get_backend_name(self):
"""Returns the name of the currently used backend""" """Returns the name of the currently used backend"""
if self.backend==1: if self.backend==2:
return "MySQL normal"
elif self.backend==2:
return "MySQL InnoDB" return "MySQL InnoDB"
elif self.backend==3: elif self.backend==3:
return "PostgreSQL" return "PostgreSQL"
else:
raise fpdb_simple.FpdbError("invalid backend")
#end def get_backend_name #end def get_backend_name
def get_db_info(self): def get_db_info(self):
@ -120,139 +133,131 @@ class fpdb_db:
"""(Re-)creates the tables of the current DB""" """(Re-)creates the tables of the current DB"""
self.drop_tables() self.drop_tables()
self.create_table("""settings ( self.create_table("""Settings (
version SMALLINT)""") version SMALLINT)""")
self.create_table("""sites ( self.create_table("""Sites (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
name varchar(32), name varchar(32),
currency char(3))""") currency char(3))""")
self.create_table("""gametypes ( self.create_table("""Gametypes (
id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id SMALLINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id), siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
type char(4), type char(4),
category varchar(9), category varchar(9),
limit_type char(2), limitType char(2),
small_blind int, smallBlind int,
big_blind int, bigBlind int,
small_bet int, smallBet int,
big_bet int)""") bigBet int)""")
self.create_table("""players ( self.create_table("""Players (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
name VARCHAR(32) CHARACTER SET utf8, name VARCHAR(32) CHARACTER SET utf8,
site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id), siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
comment text, comment text,
comment_ts DATETIME)""") commentTs DATETIME)""")
self.create_table("""autorates ( self.create_table("""Autorates (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id), playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id), gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
description varchar(50), description varchar(50),
short_desc char(8), shortDesc char(8),
rating_time DATETIME, ratingTime DATETIME,
hand_count int)""") handCount int)""")
self.create_table("""hands ( self.create_table("""Hands (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
site_hand_no bigint, siteHandNo bigint,
gametype_id SMALLINT UNSIGNED, FOREIGN KEY (gametype_id) REFERENCES gametypes(id), gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
hand_start DATETIME, handStart DATETIME,
seats smallint, seats smallint,
comment text, comment text,
comment_ts DATETIME)""") commentTs DATETIME)""")
self.create_table("""board_cards ( self.create_table("""BoardCards (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
PRIMARY KEY (id), handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
hand_id BIGINT UNSIGNED, card1Value smallint,
FOREIGN KEY (hand_id) REFERENCES hands(id), card1Suit char(1),
card1_value smallint, card2Value smallint,
card1_suit char(1), card2Suit char(1),
card2_value smallint, card3Value smallint,
card2_suit char(1), card3Suit char(1),
card3_value smallint, card4Value smallint,
card3_suit char(1), card4Suit char(1),
card4_value smallint, card5Value smallint,
card4_suit char(1), card5Suit char(1))""")
card5_value smallint,
card5_suit char(1))""")
self.create_table("""tourneys ( self.create_table("""Tourneys (
id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id INT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
site_id SMALLINT UNSIGNED, FOREIGN KEY (site_id) REFERENCES sites(id), siteId SMALLINT UNSIGNED, FOREIGN KEY (siteId) REFERENCES Sites(id),
site_tourney_no BIGINT, siteTourneyNo BIGINT,
buyin INT, buyin INT,
fee INT, fee INT,
knockout INT, knockout INT,
entries INT, entries INT,
prizepool INT, prizepool INT,
start_time DATETIME, startTime DATETIME,
comment TEXT, comment TEXT,
comment_ts DATETIME)""") commentTs DATETIME)""")
self.create_table("""tourneys_players ( self.create_table("""TourneysPlayers (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
tourney_id INT UNSIGNED, FOREIGN KEY (tourney_id) REFERENCES tourneys(id), tourneyId INT UNSIGNED, FOREIGN KEY (tourneyId) REFERENCES Tourneys(id),
player_id INT UNSIGNED, FOREIGN KEY (player_id) REFERENCES players(id), playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
payin_amount INT, payinAmount INT,
rank INT, rank INT,
winnings INT, winnings INT,
comment TEXT, comment TEXT,
comment_ts DATETIME)""") commentTs DATETIME)""")
self.create_table("""hands_players ( self.create_table("""HandsPlayers (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
PRIMARY KEY (id), handId BIGINT UNSIGNED, FOREIGN KEY (handId) REFERENCES Hands(id),
hand_id BIGINT UNSIGNED, playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
FOREIGN KEY (hand_id) REFERENCES hands(id), startCash int,
player_id INT UNSIGNED,
FOREIGN KEY (player_id) REFERENCES players(id),
player_startcash int,
position char(1), position char(1),
ante int, ante int,
card1_value smallint, card1Value smallint,
card1_suit char(1), card1Suit char(1),
card2_value smallint, card2Value smallint,
card2_suit char(1), card2Suit char(1),
card3_value smallint, card3Value smallint,
card3_suit char(1), card3Suit char(1),
card4_value smallint, card4Value smallint,
card4_suit char(1), card4Suit char(1),
card5_value smallint, card5Value smallint,
card5_suit char(1), card5Suit char(1),
card6_value smallint, card6Value smallint,
card6_suit char(1), card6Suit char(1),
card7_value smallint, card7Value smallint,
card7_suit char(1), card7Suit char(1),
winnings int, winnings int,
rake int, rake int,
comment text, comment text,
comment_ts DATETIME, commentTs DATETIME,
tourneys_players_id BIGINT UNSIGNED, tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id))""")
FOREIGN KEY (tourneys_players_id) REFERENCES tourneys_players(id))""")
self.create_table("""hands_actions ( self.create_table("""HandsActions (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
PRIMARY KEY (id), handPlayerId BIGINT UNSIGNED, FOREIGN KEY (handPlayerId) REFERENCES HandsPlayers(id),
hand_player_id BIGINT UNSIGNED,
FOREIGN KEY (hand_player_id) REFERENCES hands_players(id),
street SMALLINT, street SMALLINT,
action_no SMALLINT, actionNo SMALLINT,
action CHAR(5), action CHAR(5),
amount INT, amount INT,
comment TEXT, comment TEXT,
comment_ts DATETIME)""") commentTs DATETIME)""")
self.create_table("""HudDataHoldemOmaha ( self.create_table("""HudDataHoldemOmaha (
id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id), id BIGINT UNSIGNED UNIQUE AUTO_INCREMENT, PRIMARY KEY (id),
gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES gametypes(id), gametypeId SMALLINT UNSIGNED, FOREIGN KEY (gametypeId) REFERENCES Gametypes(id),
playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES players(id), playerId INT UNSIGNED, FOREIGN KEY (playerId) REFERENCES Players(id),
activeSeats SMALLINT, activeSeats SMALLINT,
HDs INT, HDs INT,
VPIP INT, VPIP INT,
@ -289,9 +294,9 @@ class fpdb_db:
thirdBarrelChance INT, thirdBarrelChance INT,
thirdBarrelDone INT)""") thirdBarrelDone INT)""")
self.cursor.execute("INSERT INTO settings VALUES (34);") self.cursor.execute("INSERT INTO Settings VALUES (35);")
self.cursor.execute("INSERT INTO sites VALUES (DEFAULT, \"Full Tilt Poker\", 'USD');") 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 Sites VALUES (DEFAULT, \"PokerStars\", 'USD');")
self.db.commit() self.db.commit()
print "finished recreating tables" print "finished recreating tables"
#end def recreate_tables #end def recreate_tables

View File

@ -94,7 +94,7 @@ def mainParser(db, cursor, site, category, hand):
fpdb_simple.convertBlindBet(actionTypes, actionAmounts) fpdb_simple.convertBlindBet(actionTypes, actionAmounts)
fpdb_simple.checkPositions(positions) fpdb_simple.checkPositions(positions)
cursor.execute("SELECT limit_type FROM gametypes WHERE id=%s",(gametypeID, )) cursor.execute("SELECT limitType FROM Gametypes WHERE id=%s",(gametypeID, ))
limit_type=cursor.fetchone()[0] limit_type=cursor.fetchone()[0]
fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts) fpdb_simple.convert3B4B(site, category, limit_type, actionTypes, actionAmounts)

View File

@ -457,7 +457,7 @@ def isActionLine(line):
#returns whether this is a duplicate #returns whether this is a duplicate
def isAlreadyInDB(cursor, gametypeID, siteHandNo): def isAlreadyInDB(cursor, gametypeID, siteHandNo):
cursor.execute ("SELECT id FROM hands WHERE gametype_id=%s AND site_hand_no=%s", (gametypeID, siteHandNo)) cursor.execute ("SELECT id FROM Hands WHERE gametypeId=%s AND siteHandNo=%s", (gametypeID, siteHandNo))
result=cursor.fetchall() result=cursor.fetchall()
if (len(result)>=1): if (len(result)>=1):
raise DuplicateError ("dupl") raise DuplicateError ("dupl")
@ -958,9 +958,9 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
#print "recogniseGametypeID small_bet/blind:",small_bet,"big bet/blind:", big_bet,"limit type:",limit_type #print "recogniseGametypeID small_bet/blind:",small_bet,"big bet/blind:", big_bet,"limit type:",limit_type
if (limit_type=="fl"): if (limit_type=="fl"):
cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_bet=%s AND big_bet=%s", (site_id, type, category, limit_type, small_bet, big_bet)) cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBet=%s AND bigBet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
else: else:
cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_blind=%s AND big_blind=%s", (site_id, type, category, limit_type, small_bet, big_bet)) cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBlind=%s AND bigBlind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
result=cursor.fetchone() result=cursor.fetchone()
#print "tried SELECTing gametypes.id, result:",result #print "tried SELECTing gametypes.id, result:",result
@ -975,15 +975,15 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
if (limit_type=="fl"): if (limit_type=="fl"):
big_blind=small_bet #todo: read this big_blind=small_bet #todo: read this
small_blind=big_blind/2 #todo: read this small_blind=big_blind/2 #todo: read this
cursor.execute("""INSERT INTO gametypes cursor.execute("""INSERT INTO Gametypes
(site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet) (siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet)) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet))
cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_bet=%s AND big_bet=%s", (site_id, type, category, limit_type, small_bet, big_bet)) cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBet=%s AND bigBet=%s", (site_id, type, category, limit_type, small_bet, big_bet))
else: else:
cursor.execute("""INSERT INTO gametypes cursor.execute("""INSERT INTO Gametypes
(site_id, type, category, limit_type, small_blind, big_blind, small_bet, big_bet) (siteId, type, category, limitType, smallBlind, bigBlind, smallBet, bigBet)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_bet, big_bet, 0, 0))#remember, for these bet means blind VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, type, category, limit_type, small_bet, big_bet, 0, 0))#remember, for these bet means blind
cursor.execute ("SELECT id FROM gametypes WHERE site_id=%s AND type=%s AND category=%s AND limit_type=%s AND small_blind=%s AND big_blind=%s", (site_id, type, category, limit_type, small_bet, big_bet)) cursor.execute ("SELECT id FROM Gametypes WHERE siteId=%s AND type=%s AND category=%s AND limitType=%s AND smallBlind=%s AND bigBlind=%s", (site_id, type, category, limit_type, small_bet, big_bet))
result=cursor.fetchone() result=cursor.fetchone()
#print "created new gametypes.id:",result #print "created new gametypes.id:",result
@ -995,12 +995,12 @@ def recogniseGametypeID(cursor, topline, site_id, category, isTourney):#todo: th
def recognisePlayerIDs(cursor, names, site_id): def recognisePlayerIDs(cursor, names, site_id):
result = [] result = []
for i in range (len(names)): for i in range (len(names)):
cursor.execute ("SELECT id FROM players WHERE name=%s", (names[i],)) cursor.execute ("SELECT id FROM Players WHERE name=%s", (names[i],))
tmp=cursor.fetchall() tmp=cursor.fetchall()
if (len(tmp)==0): #new player if (len(tmp)==0): #new player
cursor.execute ("INSERT INTO players (name, site_id) VALUES (%s, %s)", (names[i], site_id)) cursor.execute ("INSERT INTO Players (name, siteId) VALUES (%s, %s)", (names[i], site_id))
#print "Number of players rows inserted: %d" % cursor.rowcount #print "Number of players rows inserted: %d" % cursor.rowcount
cursor.execute ("SELECT id FROM players WHERE name=%s", (names[i],)) cursor.execute ("SELECT id FROM Players WHERE name=%s", (names[i],))
tmp=cursor.fetchall() tmp=cursor.fetchall()
#print "recognisePlayerIDs, names[i]:",names[i],"tmp:",tmp #print "recognisePlayerIDs, names[i]:",names[i],"tmp:",tmp
result.append(tmp[0][0]) result.append(tmp[0][0])
@ -1048,9 +1048,9 @@ def recogniseSite(line):
#returns the ID of the given site #returns the ID of the given site
def recogniseSiteID(cursor, site): def recogniseSiteID(cursor, site):
if (site=="ftp"): if (site=="ftp"):
cursor.execute("SELECT id FROM sites WHERE name = ('Full Tilt Poker')") cursor.execute("SELECT id FROM Sites WHERE name = ('Full Tilt Poker')")
elif (site=="ps"): elif (site=="ps"):
cursor.execute("SELECT id FROM sites WHERE name = ('PokerStars')") cursor.execute("SELECT id FROM Sites WHERE name = ('PokerStars')")
return cursor.fetchall()[0][0] return cursor.fetchall()[0][0]
#end def recogniseSiteID #end def recogniseSiteID
@ -1090,15 +1090,14 @@ def storeActions(cursor, hands_players_ids, action_types, action_amounts, action
for i in range (len(action_types)): #iterate through streets for i in range (len(action_types)): #iterate through streets
for j in range (len(action_types[i])): #iterate through names for j in range (len(action_types[i])): #iterate through names
for k in range (len(action_types[i][j])): #iterate through individual actions of that player on that street for k in range (len(action_types[i][j])): #iterate through individual actions of that player on that street
cursor.execute ("INSERT INTO hands_actions (hand_player_id, street, action_no, action, amount) VALUES (%s, %s, %s, %s, %s)", (hands_players_ids[j], i, actionNos[i][j][k], action_types[i][j][k], action_amounts[i][j][k])) cursor.execute ("INSERT INTO HandsActions (handPlayerId, street, actionNo, action, amount) VALUES (%s, %s, %s, %s, %s)", (hands_players_ids[j], i, actionNos[i][j][k], action_types[i][j][k], action_amounts[i][j][k]))
#end def storeActions #end def storeActions
def store_board_cards(cursor, hands_id, board_values, board_suits): def store_board_cards(cursor, hands_id, board_values, board_suits):
#stores into table board_cards #stores into table board_cards
cursor.execute (""" cursor.execute ("""INSERT INTO BoardCards (handId, card1Value, card1Suit,
INSERT INTO board_cards (hand_id, card1_value, card1_suit, card2Value, card2Suit, card3Value, card3Suit, card4Value, card4Suit,
card2_value, card2_suit, card3_value, card3_suit, card4_value, card4_suit, card5Value, card5Suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
card5_value, card5_suit) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, board_values[0], board_suits[0], board_values[1], board_suits[1], (hands_id, board_values[0], board_suits[0], board_values[1], board_suits[1],
board_values[2], board_suits[2], board_values[3], board_suits[3], board_values[2], board_suits[2], board_values[3], board_suits[3],
board_values[4], board_suits[4])) board_values[4], board_suits[4]))
@ -1106,9 +1105,9 @@ def store_board_cards(cursor, hands_id, board_values, board_suits):
def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names): def storeHands(cursor, site_hand_no, gametype_id, hand_start_time, names):
#stores into table hands #stores into table hands
cursor.execute ("INSERT INTO hands (site_hand_no, gametype_id, hand_start, seats) VALUES (%s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names))) cursor.execute ("INSERT INTO Hands (siteHandNo, gametypeId, handStart, seats) VALUES (%s, %s, %s, %s)", (site_hand_no, gametype_id, hand_start_time, len(names)))
#todo: find a better way of doing this... #todo: find a better way of doing this...
cursor.execute("SELECT id FROM hands WHERE site_hand_no=%s AND gametype_id=%s", (site_hand_no, gametype_id)) cursor.execute("SELECT id FROM Hands WHERE siteHandNo=%s AND gametypeId=%s", (site_hand_no, gametype_id))
return cursor.fetchall()[0][0] return cursor.fetchall()[0][0]
#end def storeHands #end def storeHands
@ -1118,22 +1117,21 @@ def store_hands_players_holdem_omaha(cursor, category, hands_id, player_ids,
if (category=="holdem"): if (category=="holdem"):
for i in range (len(player_ids)): for i in range (len(player_ids)):
cursor.execute (""" cursor.execute ("""
INSERT INTO hands_players INSERT INTO HandsPlayers
(hand_id, player_id, player_startcash, position, (handId, playerId, startCash, position,
card1_value, card1_suit, card2_value, card2_suit, winnings, rake) card1Value, card1Suit, card2Value, card2Suit, winnings, rake)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], (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][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
winnings[i], rakes[i])) winnings[i], rakes[i]))
cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i])) cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0]) result.append(cursor.fetchall()[0][0])
elif (category=="omahahi" or category=="omahahilo"): elif (category=="omahahi" or category=="omahahilo"):
for i in range (len(player_ids)): for i in range (len(player_ids)):
cursor.execute (""" cursor.execute ("""INSERT INTO HandsPlayers
INSERT INTO hands_players (handId, playerId, startCash, position,
(hand_id, player_id, player_startcash, position, card1Value, card1Suit, card2Value, card2Suit,
card1_value, card1_suit, card2_value, card2_suit, card3Value, card3Suit, card4Value, card4Suit, winnings, rake)
card3_value, card3_suit, card4_value, card4_suit, winnings, rake)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], (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][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
@ -1151,12 +1149,12 @@ def store_hands_players_stud(cursor, hands_id, player_ids, start_cashes, antes,
#stores hands_players rows for stud/razz games. returns an array of the resulting IDs #stores hands_players rows for stud/razz games. returns an array of the resulting IDs
result=[] result=[]
for i in range (len(player_ids)): for i in range (len(player_ids)):
cursor.execute ("""INSERT INTO hands_players cursor.execute ("""INSERT INTO HandsPlayers
(hand_id, player_id, player_startcash, ante, (handId, playerId, startCash, ante,
card1_value, card1_suit, card2_value, card2_suit, card1Value, card1Suit, card2Value, card2Suit,
card3_value, card3_suit, card4_value, card4_suit, card3Value, card3Suit, card4Value, card4Suit,
card5_value, card5_suit, card6_value, card6_suit, card5Value, card5Suit, card6Value, card6Suit,
card7_value, card7_suit, winnings, rake) card7Value, card7Suit, winnings, rake)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s, %s)""", %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], antes[i], (hands_id, player_ids[i], start_cashes[i], antes[i],
@ -1175,20 +1173,20 @@ def store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids, start
result=[] result=[]
for i in range (len(player_ids)): for i in range (len(player_ids)):
if len(card_values[0])==2: if len(card_values[0])==2:
cursor.execute ("""INSERT INTO hands_players cursor.execute ("""INSERT INTO HandsPlayers
(hand_id, player_id, player_startcash,position, (handId, playerId, startCash, position,
card1_value, card1_suit, card2_value, card2_suit, card1Value, card1Suit, card2Value, card2Suit,
winnings, rake, tourneys_players_id) winnings, rake, tourneysPlayersId)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], (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][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
winnings[i], rakes[i], tourneys_players_ids[i])) winnings[i], rakes[i], tourneys_players_ids[i]))
elif len(card_values[0])==4: elif len(card_values[0])==4:
cursor.execute ("""INSERT INTO hands_players cursor.execute ("""INSERT INTO HandsPlayers
(hand_id, player_id, player_startcash,position, (handId, playerId, startCash, position,
card1_value, card1_suit, card2_value, card2_suit, card1Value, card1Suit, card2Value, card2Suit,
card3_value, card3_suit, card4_value, card4_suit, card3Value, card3Suit, card4Value, card4Suit,
winnings, rake, tourneys_players_id) winnings, rake, tourneysPlayersId)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""",
(hands_id, player_ids[i], start_cashes[i], positions[i], (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][0], card_suits[i][0], card_values[i][1], card_suits[i][1],
@ -1196,7 +1194,7 @@ def store_hands_players_holdem_omaha_tourney(cursor, hands_id, player_ids, start
winnings[i], rakes[i], tourneys_players_ids[i])) winnings[i], rakes[i], tourneys_players_ids[i]))
else: else:
raise FpdbError ("invalid card_values length:"+str(len(card_values[0]))) raise FpdbError ("invalid card_values length:"+str(len(card_values[0])))
cursor.execute("SELECT id FROM hands_players WHERE hand_id=%s AND player_id=%s", (hands_id, player_ids[i])) cursor.execute("SELECT id FROM HandsPlayers WHERE handId=%s AND playerId=%s", (hands_id, player_ids[i]))
result.append(cursor.fetchall()[0][0]) result.append(cursor.fetchall()[0][0])
return result return result
@ -1207,7 +1205,7 @@ def store_hands_players_stud_tourney(cursor, hands_id, player_ids, start_cashes,
#stores hands_players for tourney stud/razz hands #stores hands_players for tourney stud/razz hands
result=[] result=[]
for i in range (len(player_ids)): for i in range (len(player_ids)):
cursor.execute ("""INSERT INTO hands_players cursor.execute ("""INSERT INTO HandsPlayers
(hand_id, player_id, player_startcash, ante, (hand_id, player_id, player_startcash, ante,
card1_value, card1_suit, card2_value, card2_suit, card1_value, card1_suit, card2_value, card2_suit,
card3_value, card3_suit, card4_value, card4_suit, card3_value, card3_suit, card4_value, card4_suit,
@ -1647,17 +1645,17 @@ def storeHudData(cursor, category, gametypeId, playerIds, hudImportData):
#end def storeHudData #end def storeHudData
def store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time): def store_tourneys(cursor, site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time):
cursor.execute("SELECT id FROM tourneys WHERE site_tourney_no=%s AND site_id=%s", (site_tourney_no, site_id)) cursor.execute("SELECT id FROM Tourneys WHERE siteTourneyNo=%s AND siteId=%s", (site_tourney_no, site_id))
tmp=cursor.fetchone() tmp=cursor.fetchone()
#print "tried SELECTing tourneys.id, result:",tmp #print "tried SELECTing tourneys.id, result:",tmp
try: try:
len(tmp) len(tmp)
except TypeError: except TypeError:
cursor.execute("""INSERT INTO tourneys cursor.execute("""INSERT INTO Tourneys
(site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time) (siteId, siteTourneyNo, buyin, fee, knockout, entries, prizepool, startTime)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time)) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)""", (site_id, site_tourney_no, buyin, fee, knockout, entries, prizepool, start_time))
cursor.execute("SELECT id FROM tourneys WHERE site_tourney_no=%s AND site_id=%s", (site_tourney_no, site_id)) cursor.execute("SELECT id FROM Tourneys WHERE siteTourneyNo=%s AND siteId=%s", (site_tourney_no, site_id))
tmp=cursor.fetchone() tmp=cursor.fetchone()
#print "created new tourneys.id:",tmp #print "created new tourneys.id:",tmp
return tmp[0] return tmp[0]
@ -1671,18 +1669,18 @@ def store_tourneys_players(cursor, tourney_id, player_ids, payin_amounts, ranks,
#print "ranks:",ranks #print "ranks:",ranks
#print "winnings:",winnings #print "winnings:",winnings
for i in range (len(player_ids)): for i in range (len(player_ids)):
cursor.execute("SELECT id FROM tourneys_players WHERE tourney_id=%s AND player_id=%s", (tourney_id, player_ids[i])) cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId=%s", (tourney_id, player_ids[i]))
tmp=cursor.fetchone() tmp=cursor.fetchone()
#print "tried SELECTing tourneys_players.id:",tmp #print "tried SELECTing tourneys_players.id:",tmp
try: try:
len(tmp) len(tmp)
except TypeError: except TypeError:
cursor.execute("""INSERT INTO tourneys_players cursor.execute("""INSERT INTO TourneysPlayers
(tourney_id, player_id, payin_amount, rank, winnings) VALUES (%s, %s, %s, %s, %s)""", (tourneyId, playerId, payinAmount, rank, winnings) VALUES (%s, %s, %s, %s, %s)""",
(tourney_id, player_ids[i], payin_amounts[i], ranks[i], winnings[i])) (tourney_id, player_ids[i], payin_amounts[i], ranks[i], winnings[i]))
cursor.execute("SELECT id FROM tourneys_players WHERE tourney_id=%s AND player_id=%s", cursor.execute("SELECT id FROM TourneysPlayers WHERE tourneyId=%s AND playerId=%s",
(tourney_id, player_ids[i])) (tourney_id, player_ids[i]))
tmp=cursor.fetchone() tmp=cursor.fetchone()
#print "created new tourneys_players.id:",tmp #print "created new tourneys_players.id:",tmp

View File

@ -177,26 +177,26 @@ class table_viewer (threading.Thread):
#print "self.last_read_hand:",self.last_read_hand #print "self.last_read_hand:",self.last_read_hand
self.db.reconnect() self.db.reconnect()
self.cursor=self.db.cursor self.cursor=self.db.cursor
self.cursor.execute("""SELECT id FROM hands WHERE site_hand_no=%s""", (self.last_read_hand)) self.cursor.execute("""SELECT id FROM Hands WHERE siteHandNo=%s""", (self.last_read_hand))
hands_id_tmp=self.db.cursor.fetchone() hands_id_tmp=self.db.cursor.fetchone()
#print "tmp:",hands_id_tmp #print "tmp:",hands_id_tmp
self.hands_id=hands_id_tmp[0] self.hands_id=hands_id_tmp[0]
self.db.cursor.execute("SELECT gametype_id FROM hands WHERE id=%s", (self.hands_id, )) self.db.cursor.execute("SELECT gametypeId FROM Hands WHERE id=%s", (self.hands_id, ))
self.gametype_id=self.db.cursor.fetchone()[0] self.gametype_id=self.db.cursor.fetchone()[0]
self.cursor.execute("SELECT category FROM gametypes WHERE id=%s", (self.gametype_id, )) self.cursor.execute("SELECT category FROM Gametypes WHERE id=%s", (self.gametype_id, ))
self.category=self.db.cursor.fetchone()[0] self.category=self.db.cursor.fetchone()[0]
#print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id #print "self.gametype_id", self.gametype_id," category:", self.category, " self.hands_id:", self.hands_id
self.db.cursor.execute("""SELECT DISTINCT players.id FROM hands_players self.db.cursor.execute("""SELECT DISTINCT Players.id FROM HandsPlayers
INNER JOIN players ON hands_players.player_id=players.id INNER JOIN Players ON HandsPlayers.playerId=Players.id
WHERE hand_id=%s""", (self.hands_id, )) WHERE handId=%s""", (self.hands_id, ))
self.player_ids=self.db.cursor.fetchall() self.player_ids=self.db.cursor.fetchall()
#print "self.player_ids:",self.player_ids #print "self.player_ids:",self.player_ids
self.db.cursor.execute("""SELECT DISTINCT players.name FROM hands_players self.db.cursor.execute("""SELECT DISTINCT Players.name FROM HandsPlayers
INNER JOIN players ON hands_players.player_id=players.id INNER JOIN Players ON HandsPlayers.playerId=Players.id
WHERE hand_id=%s""", (self.hands_id, )) WHERE handId=%s""", (self.hands_id, ))
self.player_names=self.db.cursor.fetchall() self.player_names=self.db.cursor.fetchall()
#print "self.player_names:",self.player_names #print "self.player_names:",self.player_names
#end def table_viewer.read_names_clicked #end def table_viewer.read_names_clicked