game.gamestorage.texas.db
Class SetterQuery

java.lang.Object
  extended by game.gamestorage.texas.db.SetterQuery

public final class SetterQuery
extends java.lang.Object

This class holds the sql-queries for writing to db

Author:
Witthold/Korol

Constructor Summary
SetterQuery()
           
 
Method Summary
protected static java.lang.String emptyTable(java.lang.String tblName)
          For TESTING only!
protected static java.lang.String insertBets(java.util.ArrayList<Action> bets, int round_id, int[] player_ids)
           
protected static java.lang.String insertCardOfPlayer(int value, int hand_player_map_id)
           
protected static java.lang.String insertCommonCards(int[] value, int round_id)
           
protected static java.lang.String insertCompetition(int gamedef_id)
           
protected static java.lang.String insertCompetitionPlayerMap(int[] player_ids, int[] cash_init, int competition_id)
           
protected static java.lang.String insertGameDef(int limited, int minBet, int maxBet, int num_players, int style, int buyin)
           
protected static java.lang.String insertHand(int sb, int bb, int ante, int competition_id)
           
protected static java.lang.String insertHandPlayerMap(int position, int cash_init, int player_id, int hand_id)
           
protected static java.lang.String insertPlayer(java.lang.String alias)
           
protected static java.lang.String insertRound(int hand_id, long timestamp)
           
protected static java.lang.String selectGameDefID(int limited, int minBet, int maxBet, int num_players, int style, int buyin)
           
protected static java.lang.String selectPlayerAliasesIDs(java.lang.String[] alias)
           
protected static java.lang.String updateCashDelta(int cash_delta, int player_id, int hand_id)
           
protected static java.lang.String updateFinalPot(int finalpot, int hand_id)
           
protected static java.lang.String updateRank(int rank, int player_id, int competition_id)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetterQuery

public SetterQuery()
Method Detail

insertGameDef

protected static java.lang.String insertGameDef(int limited,
                                                int minBet,
                                                int maxBet,
                                                int num_players,
                                                int style,
                                                int buyin)
Parameters:
limited - - limited:1; pot-limit:0; no-limit: -1
minBet - - only int possible
maxBet - - only int possible
num_players - -
style - - cashgame:1; tournament:2; doyle:3;
buyin - - only int possible
Returns:
String sql-query

selectGameDefID

protected static java.lang.String selectGameDefID(int limited,
                                                  int minBet,
                                                  int maxBet,
                                                  int num_players,
                                                  int style,
                                                  int buyin)
Parameters:
limited - - limited:1; pot-limit:0; no-limit: -1
minBet - - only int possible
maxBet - - only int possible
num_players - -
style - - cashgame:1; tournament:2; doyle:3;
buyin - - only int possible
Returns:
String sql-query

insertCompetition

protected static java.lang.String insertCompetition(int gamedef_id)
Parameters:
gamedef_id - - already generated by db
Returns:
String sql-query

selectPlayerAliasesIDs

protected static java.lang.String selectPlayerAliasesIDs(java.lang.String[] alias)
Parameters:
alias - - all playernames
Returns:
String sql-query

insertPlayer

protected static java.lang.String insertPlayer(java.lang.String alias)
Parameters:
alias - - name of specific player
Returns:
String sql-query

insertCompetitionPlayerMap

protected static java.lang.String insertCompetitionPlayerMap(int[] player_ids,
                                                             int[] cash_init,
                                                             int competition_id)
Parameters:
player_ids - already generated by db
cash_init - - with how much credits do the players start this? -
competition_id - already generated by db
Returns:
String sql-query

insertHand

protected static java.lang.String insertHand(int sb,
                                             int bb,
                                             int ante,
                                             int competition_id)
Parameters:
sb - - smallblind
bb - - bigblind
ante - - forced bet for all players
competition_id - already generated by db
Returns:
String sql-query

insertHandPlayerMap

protected static java.lang.String insertHandPlayerMap(int position,
                                                      int cash_init,
                                                      int player_id,
                                                      int hand_id)
Parameters:
position - Position of the player in this hand (0: first player behind the button; 1: second player behind the button; ...)
cash_init - - with how much credits do the players start this? -
player_id - already generated by db
hand_id - already generated by db
Returns:
String sql-query

insertCardOfPlayer

protected static java.lang.String insertCardOfPlayer(int value,
                                                     int hand_player_map_id)
Parameters:
value - of the card (combination of number and suite)
hand_player_map_id - already generated by db
Returns:
String sql-query

insertRound

protected static java.lang.String insertRound(int hand_id,
                                              long timestamp)
Parameters:
hand_id - already generated by db
timestamp - as unix timestamp
Returns:
String sql-query

insertCommonCards

protected static java.lang.String insertCommonCards(int[] value,
                                                    int round_id)
Parameters:
value - of the card (combination of number and suite)
round_id - already generated by db
Returns:
String sql-query

insertBets

protected static java.lang.String insertBets(java.util.ArrayList<Action> bets,
                                             int round_id,
                                             int[] player_ids)
Parameters:
bets - - ArrayList of Actions of the players in this round
round_id - already generated by db
player_ids - already generated by db
Returns:
String sql-query

updateFinalPot

protected static java.lang.String updateFinalPot(int finalpot,
                                                 int hand_id)
Parameters:
finalpot - - total at the end of the hand
hand_id - already generated by db
Returns:
String sql-query

updateCashDelta

protected static java.lang.String updateCashDelta(int cash_delta,
                                                  int player_id,
                                                  int hand_id)
Parameters:
cash_delta - - diff between before and after played hand
player_id - already generated by db
hand_id - already generated by db
Returns:
String sql-query

updateRank

protected static java.lang.String updateRank(int rank,
                                             int player_id,
                                             int competition_id)
Parameters:
rank - - rank of this player
player_id - already generated by db
competition_id - already generated by db
Returns:
String sql-query

emptyTable

protected static java.lang.String emptyTable(java.lang.String tblName)
For TESTING only!

Parameters:
tblName - -
Returns:
String sql-query