game.gamestorage.texas.db
Class SetterQueryExecution

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

public class SetterQueryExecution
extends java.lang.Object

This class is the "db-side" part of the mapping form Java to database
Responsable for writing to db

Author:
Witthold/Korol

Field Summary
protected static SQLHandler h
          SQLHandler initializes ConnectionManager
 
Constructor Summary
SetterQueryExecution()
           
 
Method Summary
static boolean connectionSuccess()
           
protected static boolean emptyTable(java.lang.String tblName)
          For TESTING only!
protected static boolean registerBets(java.util.ArrayList<Action> bets, int round_id, int[] player_ids)
           
protected static boolean registerCardOfPlayer(int value, int hand_player_map_id)
           
protected static boolean registerCashDelta(int cash_delta, int player_id, int hand_id)
           
protected static boolean registerCommonCards(int[] value, int round_id)
           
protected static int registerCompetition(int gamedef_id)
           
protected static boolean registerCompetitionPlayerMap(int[] player_ids, int[] cash_init, int competition_id)
           
protected static boolean registerFinalPot(int finalpot, int hand_id)
           
protected static int registerGameDef(int limited, int minBet, int maxBet, int num_players, int style, int buyin)
           
protected static int registerHand(int sb, int bb, int ante, int competition_id)
           
protected static int[] registerHandPlayerMap(int[] position, int[] cash_init, int[] player_ids, int hand_id)
           
protected static int[] registerPlayers(java.lang.String[] player_names)
           
protected static boolean registerRank(int rank, int player_id, int competition_id)
           
protected static int registerRound(int hand_id, long timestamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

h

protected static SQLHandler h
SQLHandler initializes ConnectionManager

Constructor Detail

SetterQueryExecution

public SetterQueryExecution()
Method Detail

registerGameDef

protected static int registerGameDef(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:
gamedef_id

registerCompetition

protected static int registerCompetition(int gamedef_id)
Parameters:
gamedef_id - - already generated by db
Returns:
competition_id

registerPlayers

protected static int[] registerPlayers(java.lang.String[] player_names)
Parameters:
player_names - - all participants as String[]
Returns:
player_ids

registerCompetitionPlayerMap

protected static boolean registerCompetitionPlayerMap(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:
true, if writing to db succeeded

registerHand

protected static int registerHand(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:
hand_id

registerHandPlayerMap

protected static int[] registerHandPlayerMap(int[] position,
                                             int[] cash_init,
                                             int[] player_ids,
                                             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_ids - already generated by db
hand_id - already generated by db
Returns:
hand_player_map_ids

registerCardOfPlayer

protected static boolean registerCardOfPlayer(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:
true, if writing to db succeeded

registerRound

protected static int registerRound(int hand_id,
                                   long timestamp)
Parameters:
hand_id - already generated by db
timestamp - as unix timestamp
Returns:
round_id

registerBets

protected static boolean registerBets(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:
true, if writing to db succeeded

registerCommonCards

protected static boolean registerCommonCards(int[] value,
                                             int round_id)
Parameters:
value - of the card (combination of number and suite)
round_id - already generated by db
Returns:
true, if writing to db succeeded

registerFinalPot

protected static boolean registerFinalPot(int finalpot,
                                          int hand_id)
Parameters:
finalpot - - total at the end of the hand
hand_id - already generated by db
Returns:
true, if writing to db succeeded

registerCashDelta

protected static boolean registerCashDelta(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:
true, if writing to db succeeded

registerRank

protected static boolean registerRank(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:
true, if writing to db succeeded

connectionSuccess

public static boolean connectionSuccess()
Returns:
true, if there is at least one connection to the db

emptyTable

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

Parameters:
tblName - -
Returns:
true, if writing to db succeeded