|
@@ -6,6 +6,8 @@ import mysql.Mysql;
|
|
|
import objects.*;
|
|
import objects.*;
|
|
|
import objects.bets.Bet;
|
|
import objects.bets.Bet;
|
|
|
import objects.bets.Bet.Status;
|
|
import objects.bets.Bet.Status;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
@@ -19,8 +21,20 @@ import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.AbstractMap.SimpleEntry;
|
|
import java.util.AbstractMap.SimpleEntry;
|
|
|
|
|
|
|
|
|
|
+import static objects.Constants.COUNTRY_ID;
|
|
|
|
|
+
|
|
|
public class GuiMysql extends Mysql {
|
|
public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
|
|
+ public static final String MATCH_ID = "matchId";
|
|
|
|
|
+ public static final String ID = "id";
|
|
|
|
|
+ public static final String BET = "bet";
|
|
|
|
|
+ public static final String BET_AMOUNT = "betAmount";
|
|
|
|
|
+ public static final String BET_ODDS = "betOdds";
|
|
|
|
|
+ public static final String STATUS = "status";
|
|
|
|
|
+ public static final String COVERED_BET_ID = "coveredBetId";
|
|
|
|
|
+ public static final String SQL_ERROR = "Sql error: ";
|
|
|
|
|
+ private Logger LOG = LoggerFactory.getLogger(GuiMysql.class);
|
|
|
|
|
+
|
|
|
private static final String SEASON = "season";
|
|
private static final String SEASON = "season";
|
|
|
private static final String AWAY_SCORE = "awayScore";
|
|
private static final String AWAY_SCORE = "awayScore";
|
|
|
private static final String HOME_SCORE = "homeScore";
|
|
private static final String HOME_SCORE = "homeScore";
|
|
@@ -36,6 +50,14 @@ public class GuiMysql extends Mysql {
|
|
|
private static final BigDecimal INCREMENT = BigDecimal.valueOf(0.2);
|
|
private static final BigDecimal INCREMENT = BigDecimal.valueOf(0.2);
|
|
|
private static final GuiMysql instance = new GuiMysql();
|
|
private static final GuiMysql instance = new GuiMysql();
|
|
|
public static final String GAME_DATE = "gameDate";
|
|
public static final String GAME_DATE = "gameDate";
|
|
|
|
|
+ public static final String SCORING_TOTAL = "scoringTotal";
|
|
|
|
|
+ public static final String WIN_LOSS_RATIO_HOME_AND_AWAY = "winLossRatioHomeAndAway";
|
|
|
|
|
+ public static final String WIN_LOSS_RATIO = "winLossRatio";
|
|
|
|
|
+ public static final String SCORING_DIFF_LAST_GAME = "scoringDiffLastGame";
|
|
|
|
|
+ public static final String DRAW_DIFF_HOME_AWAY = "drawDiffHomeAway";
|
|
|
|
|
+ public static final String DRAW_DIFF_TOTAL_GOALS = "drawDiffTotalGoals";
|
|
|
|
|
+ public static final String DRAW_WINNING_FORM = "drawWinningForm";
|
|
|
|
|
+ public static final String DRAW_WINNING_FORM_HOME_AWAY = "drawWinningFormHomeAway";
|
|
|
|
|
|
|
|
|
|
|
|
|
protected GuiMysql() {
|
|
protected GuiMysql() {
|
|
@@ -66,7 +88,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -88,7 +110,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.execute();
|
|
stat.execute();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -107,19 +129,19 @@ public class GuiMysql extends Mysql {
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
|
- SoccerMatch match = new SoccerMatch(rs.getInt("matchId"), homeTeam, awayTeam, rs.getFloat("odds1"),
|
|
|
|
|
- rs.getFloat("oddsX"), rs.getFloat("odds2"), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
|
|
|
- LocalDateTime.parse(rs.getString("gameDate")), rs.getString(SEASON));
|
|
|
|
|
|
|
+ SoccerMatch match = new SoccerMatch(rs.getInt(MATCH_ID), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
|
|
+ rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
|
|
|
+ LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON));
|
|
|
|
|
|
|
|
match.setLeagueName(homeTeam.getTeamLeague());
|
|
match.setLeagueName(homeTeam.getTeamLeague());
|
|
|
match.setCountryName(homeTeam.getCountryName());
|
|
match.setCountryName(homeTeam.getCountryName());
|
|
|
|
|
|
|
|
- result = new Bet(rs.getInt("id"), match, rs.getString("bet"), rs.getFloat("betAmount"), rs.getFloat(
|
|
|
|
|
- "betOdds"), Status.valueOf(rs.getString("status")), rs.getInt("coveredBetId"));
|
|
|
|
|
|
|
+ result = new Bet(rs.getInt(ID), match, rs.getString(BET), rs.getFloat(BET_AMOUNT), rs.getFloat(
|
|
|
|
|
+ BET_ODDS), Status.valueOf(rs.getString(STATUS)), rs.getInt(COVERED_BET_ID));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -139,19 +161,19 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
|
- SoccerMatch match = new SoccerMatch(rs.getInt("matchId"), homeTeam, awayTeam, rs.getFloat("odds1"),
|
|
|
|
|
- rs.getFloat("oddsX"), rs.getFloat("odds2"), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
|
|
|
- LocalDateTime.parse(rs.getString("gameDate")), rs.getString(SEASON));
|
|
|
|
|
|
|
+ SoccerMatch match = new SoccerMatch(rs.getInt(MATCH_ID), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
|
|
+ rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
|
|
|
+ LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON));
|
|
|
|
|
|
|
|
match.setLeagueName(homeTeam.getTeamLeague());
|
|
match.setLeagueName(homeTeam.getTeamLeague());
|
|
|
match.setCountryName(homeTeam.getCountryName());
|
|
match.setCountryName(homeTeam.getCountryName());
|
|
|
|
|
|
|
|
- result.add(new Bet(rs.getInt("id"), match, rs.getString("bet"), rs.getFloat("betAmount"),
|
|
|
|
|
- rs.getFloat("betOdds"), Status.valueOf(rs.getString("status")), rs.getInt("coveredBetId")));
|
|
|
|
|
|
|
+ result.add(new Bet(rs.getInt(ID), match, rs.getString(BET), rs.getFloat(BET_AMOUNT),
|
|
|
|
|
+ rs.getFloat(BET_ODDS), Status.valueOf(rs.getString(STATUS)), rs.getInt(COVERED_BET_ID)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -175,17 +197,17 @@ public class GuiMysql extends Mysql {
|
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
|
SoccerMatch match = new SoccerMatch(rs.getInt("soccerMatchId"), homeTeam, awayTeam, rs.getFloat(
|
|
SoccerMatch match = new SoccerMatch(rs.getInt("soccerMatchId"), homeTeam, awayTeam, rs.getFloat(
|
|
|
- "odds1"), rs.getFloat("oddsX"), rs.getFloat("odds2"), rs.getInt(HOME_SCORE),
|
|
|
|
|
- rs.getInt(AWAY_SCORE), LocalDateTime.parse(rs.getString("gameDate")), rs.getString(SEASON));
|
|
|
|
|
|
|
+ "odds1"), rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE),
|
|
|
|
|
+ rs.getInt(AWAY_SCORE), LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON));
|
|
|
match.setLeagueName(rs.getString(LEAGUE_NAME));
|
|
match.setLeagueName(rs.getString(LEAGUE_NAME));
|
|
|
|
|
|
|
|
- Bet bet = new Bet(rs.getInt("betId"), match, rs.getString("bet"), rs.getFloat("betAmount"),
|
|
|
|
|
- rs.getFloat("betOdds"));
|
|
|
|
|
|
|
+ Bet bet = new Bet(rs.getInt("betId"), match, rs.getString(BET), rs.getFloat(BET_AMOUNT),
|
|
|
|
|
+ rs.getFloat(BET_ODDS));
|
|
|
|
|
|
|
|
result.add(bet);
|
|
result.add(bet);
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -207,7 +229,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -247,7 +269,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -270,7 +292,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -311,7 +333,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -331,7 +353,7 @@ public class GuiMysql extends Mysql {
|
|
|
result = rs.getString("value");
|
|
result = rs.getString("value");
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -355,19 +377,19 @@ public class GuiMysql extends Mysql {
|
|
|
BetDTO dto = new BetDTO();
|
|
BetDTO dto = new BetDTO();
|
|
|
dto.setHomeTeam(rs.getString("homeTeam"));
|
|
dto.setHomeTeam(rs.getString("homeTeam"));
|
|
|
dto.setAwayTeam(rs.getString("awayTeam"));
|
|
dto.setAwayTeam(rs.getString("awayTeam"));
|
|
|
- dto.setBet(rs.getFloat("bet"));
|
|
|
|
|
|
|
+ dto.setBet(rs.getFloat(BET));
|
|
|
dto.setBetType(rs.getString("betType"));
|
|
dto.setBetType(rs.getString("betType"));
|
|
|
dto.setBetSeries(rs.getInt("series"));
|
|
dto.setBetSeries(rs.getInt("series"));
|
|
|
dto.setGameId(rs.getInt("gameId"));
|
|
dto.setGameId(rs.getInt("gameId"));
|
|
|
dto.setMatch(rs.getString("homeTeam"), rs.getString("awayTeam"));
|
|
dto.setMatch(rs.getString("homeTeam"), rs.getString("awayTeam"));
|
|
|
dto.setOdds(rs.getFloat("odds"));
|
|
dto.setOdds(rs.getFloat("odds"));
|
|
|
dto.setResult(rs.getInt(HOME_SCORE), rs.getInt("AwayScore"));
|
|
dto.setResult(rs.getInt(HOME_SCORE), rs.getInt("AwayScore"));
|
|
|
- dto.setGameDate(rs.getString("gameDate"));
|
|
|
|
|
- dto.setWinAmount(rs.getFloat("odds") * rs.getFloat("bet"));
|
|
|
|
|
|
|
+ dto.setGameDate(rs.getString(GAME_DATE));
|
|
|
|
|
+ dto.setWinAmount(rs.getFloat("odds") * rs.getFloat(BET));
|
|
|
result.add(dto);
|
|
result.add(dto);
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -386,7 +408,7 @@ public class GuiMysql extends Mysql {
|
|
|
result = rs.getInt(1);
|
|
result = rs.getInt(1);
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -408,7 +430,7 @@ public class GuiMysql extends Mysql {
|
|
|
countries.add(entry);
|
|
countries.add(entry);
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -433,7 +455,7 @@ public class GuiMysql extends Mysql {
|
|
|
result.add(new SimpleEntry<>(rs.getInt(Constants.ID), rs.getString("name")));
|
|
result.add(new SimpleEntry<>(rs.getInt(Constants.ID), rs.getString("name")));
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -458,11 +480,11 @@ public class GuiMysql extends Mysql {
|
|
|
ResultSet rs = stat.executeQuery();
|
|
ResultSet rs = stat.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- result = rs.getInt("id");
|
|
|
|
|
|
|
+ result = rs.getInt(ID);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -491,7 +513,7 @@ public class GuiMysql extends Mysql {
|
|
|
returnValue.put(tg, numGoals);
|
|
returnValue.put(tg, numGoals);
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -516,7 +538,7 @@ public class GuiMysql extends Mysql {
|
|
|
season = rs.getString(Constants.SEASON);
|
|
season = rs.getString(Constants.SEASON);
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -541,7 +563,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -557,13 +579,13 @@ public class GuiMysql extends Mysql {
|
|
|
final ResultSet rs = stat.executeQuery();
|
|
final ResultSet rs = stat.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- result = new League(rs.getInt(Constants.ID), rs.getString("name"), rs.getInt("scoringDiffLastGame"),
|
|
|
|
|
- rs.getInt("scoringTotal"), rs.getInt("winLossRatioHomeAndAway"), rs.getInt("winLossRatio"),
|
|
|
|
|
- rs.getInt("drawDiffHomeAway"), rs.getInt("drawDiffTotalGoals"), rs.getInt("drawWinningForm"),
|
|
|
|
|
- rs.getInt("drawWinningFormHomeAway"));
|
|
|
|
|
|
|
+ result = new League(rs.getInt(Constants.ID), rs.getString("name"), rs.getInt(SCORING_DIFF_LAST_GAME),
|
|
|
|
|
+ rs.getInt(SCORING_TOTAL), rs.getInt(WIN_LOSS_RATIO_HOME_AND_AWAY), rs.getInt(WIN_LOSS_RATIO),
|
|
|
|
|
+ rs.getInt(DRAW_DIFF_HOME_AWAY), rs.getInt(DRAW_DIFF_TOTAL_GOALS), rs.getInt(DRAW_WINNING_FORM),
|
|
|
|
|
+ rs.getInt(DRAW_WINNING_FORM_HOME_AWAY));
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -579,13 +601,13 @@ public class GuiMysql extends Mysql {
|
|
|
final ResultSet rs = stat.executeQuery();
|
|
final ResultSet rs = stat.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- result = new League(rs.getInt(Constants.ID), rs.getString("name"), rs.getInt("scoringDiffLastGame"),
|
|
|
|
|
- rs.getInt("scoringTotal"), rs.getInt("winLossRatioHomeAndAway"), rs.getInt("winLossRatio"),
|
|
|
|
|
- rs.getInt("drawDiffHomeAway"), rs.getInt("drawDiffTotalGoals"), rs.getInt("drawWinningForm"),
|
|
|
|
|
|
|
+ result = new League(rs.getInt(Constants.ID), rs.getString("name"), rs.getInt(SCORING_DIFF_LAST_GAME),
|
|
|
|
|
+ rs.getInt(SCORING_TOTAL), rs.getInt(WIN_LOSS_RATIO_HOME_AND_AWAY), rs.getInt(WIN_LOSS_RATIO),
|
|
|
|
|
+ rs.getInt(DRAW_DIFF_HOME_AWAY), rs.getInt(DRAW_DIFF_TOTAL_GOALS), rs.getInt(DRAW_WINNING_FORM),
|
|
|
rs.getInt("drawWinngingFormHomeAway"));
|
|
rs.getInt("drawWinngingFormHomeAway"));
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -609,7 +631,7 @@ public class GuiMysql extends Mysql {
|
|
|
leagues.add(entry);
|
|
leagues.add(entry);
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -625,11 +647,11 @@ public class GuiMysql extends Mysql {
|
|
|
ResultSet rs = stat.executeQuery();
|
|
ResultSet rs = stat.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- League l = new League(rs.getInt("id"), rs.getString("name"), rs.getInt("scoringDiffLastGame"),
|
|
|
|
|
- rs.getInt("scoringTotal"),
|
|
|
|
|
- rs.getInt("winLossRatioHomeAndAway"), rs.getInt("winLossRatio"), rs.getInt("drawDiffHomeAway"),
|
|
|
|
|
- rs.getInt("drawDiffTotalGoals"),
|
|
|
|
|
- rs.getInt("drawWinningForm"), rs.getInt("drawWinningFormHomeAway"));
|
|
|
|
|
|
|
+ League l = new League(rs.getInt(ID), rs.getString("name"), rs.getInt(SCORING_DIFF_LAST_GAME),
|
|
|
|
|
+ rs.getInt(SCORING_TOTAL),
|
|
|
|
|
+ rs.getInt(WIN_LOSS_RATIO_HOME_AND_AWAY), rs.getInt(WIN_LOSS_RATIO), rs.getInt(DRAW_DIFF_HOME_AWAY),
|
|
|
|
|
+ rs.getInt(DRAW_DIFF_TOTAL_GOALS),
|
|
|
|
|
+ rs.getInt(DRAW_WINNING_FORM), rs.getInt(DRAW_WINNING_FORM_HOME_AWAY));
|
|
|
l.setCountryName(rs.getString("cName"));
|
|
l.setCountryName(rs.getString("cName"));
|
|
|
l.setPrio(rs.getBoolean("prio"));
|
|
l.setPrio(rs.getBoolean("prio"));
|
|
|
result.add(l);
|
|
result.add(l);
|
|
@@ -637,7 +659,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
System.out.println("Someting wrong with sql " + sql);
|
|
System.out.println("Someting wrong with sql " + sql);
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -661,7 +683,7 @@ public class GuiMysql extends Mysql {
|
|
|
leagues.add(entry);
|
|
leagues.add(entry);
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -698,7 +720,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -769,8 +791,8 @@ public class GuiMysql extends Mysql {
|
|
|
awayTeam.setTeamLeagueId(rs.getInt(Constants.LEAGUE_ID));
|
|
awayTeam.setTeamLeagueId(rs.getInt(Constants.LEAGUE_ID));
|
|
|
homeTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
homeTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
|
awayTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
awayTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
|
- homeTeam.setCountryId(rs.getInt(Constants.COUNTRY_ID));
|
|
|
|
|
- awayTeam.setCountryId(rs.getInt(Constants.COUNTRY_ID));
|
|
|
|
|
|
|
+ homeTeam.setCountryId(rs.getInt(COUNTRY_ID));
|
|
|
|
|
+ awayTeam.setCountryId(rs.getInt(COUNTRY_ID));
|
|
|
homeTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
homeTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
|
awayTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
awayTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
|
|
|
|
|
@@ -794,7 +816,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -821,7 +843,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -917,7 +939,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -943,7 +965,7 @@ public class GuiMysql extends Mysql {
|
|
|
returnValue = rs.getString(SEASON);
|
|
returnValue = rs.getString(SEASON);
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -964,7 +986,7 @@ public class GuiMysql extends Mysql {
|
|
|
sports.add(entry);
|
|
sports.add(entry);
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1028,7 +1050,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1084,7 +1106,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1101,11 +1123,11 @@ public class GuiMysql extends Mysql {
|
|
|
ResultSet rs = stat.executeQuery();
|
|
ResultSet rs = stat.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- result = new Team(rs.getInt("id"), rs.getString("name"), rs.getInt("countryId"),
|
|
|
|
|
|
|
+ result = new Team(rs.getInt(ID), rs.getString("name"), rs.getInt("countryId"),
|
|
|
rs.getString(COUNTRY_NAME), rs.getInt("leagueId"), rs.getString(LEAGUE_NAME));
|
|
rs.getString(COUNTRY_NAME), rs.getInt("leagueId"), rs.getString(LEAGUE_NAME));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
//closeConnection();
|
|
//closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1142,7 +1164,7 @@ public class GuiMysql extends Mysql {
|
|
|
tr.setCount(wins + draws + lost);
|
|
tr.setCount(wins + draws + lost);
|
|
|
}
|
|
}
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1182,7 +1204,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1220,8 +1242,8 @@ public class GuiMysql extends Mysql {
|
|
|
awayTeam.setTeamLeagueId(rs.getInt(Constants.LEAGUE_ID));
|
|
awayTeam.setTeamLeagueId(rs.getInt(Constants.LEAGUE_ID));
|
|
|
homeTeam.setTeamLeague(rs.getString(Constants.LEAGUE_NAME));
|
|
homeTeam.setTeamLeague(rs.getString(Constants.LEAGUE_NAME));
|
|
|
awayTeam.setTeamLeague(rs.getString(Constants.LEAGUE_NAME));
|
|
awayTeam.setTeamLeague(rs.getString(Constants.LEAGUE_NAME));
|
|
|
- homeTeam.setCountryId(rs.getInt(Constants.COUNTRY_ID));
|
|
|
|
|
- awayTeam.setCountryId(rs.getInt(Constants.COUNTRY_ID));
|
|
|
|
|
|
|
+ homeTeam.setCountryId(rs.getInt(COUNTRY_ID));
|
|
|
|
|
+ awayTeam.setCountryId(rs.getInt(COUNTRY_ID));
|
|
|
homeTeam.setCountryName(rs.getString(Constants.COUNTRY_NAME));
|
|
homeTeam.setCountryName(rs.getString(Constants.COUNTRY_NAME));
|
|
|
awayTeam.setCountryName(rs.getString(Constants.COUNTRY_NAME));
|
|
awayTeam.setCountryName(rs.getString(Constants.COUNTRY_NAME));
|
|
|
|
|
|
|
@@ -1240,7 +1262,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1267,7 +1289,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1283,7 +1305,7 @@ public class GuiMysql extends Mysql {
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1299,7 +1321,7 @@ public class GuiMysql extends Mysql {
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1315,7 +1337,7 @@ public class GuiMysql extends Mysql {
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1331,7 +1353,7 @@ public class GuiMysql extends Mysql {
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1347,7 +1369,7 @@ public class GuiMysql extends Mysql {
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1363,7 +1385,7 @@ public class GuiMysql extends Mysql {
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1379,7 +1401,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.execute();
|
|
stat.execute();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1394,7 +1416,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.executeUpdate();
|
|
stat.executeUpdate();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1413,7 +1435,7 @@ public class GuiMysql extends Mysql {
|
|
|
returnValue.add(rs.getString(SEASON));
|
|
returnValue.add(rs.getString(SEASON));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1437,14 +1459,14 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
ResultSet rs = stat.executeQuery();
|
|
ResultSet rs = stat.executeQuery();
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- match = new SoccerMatch(rs.getInt("id"), getTeam(rs.getInt(HOME_TEAM_ID)), getTeam(rs.getInt(
|
|
|
|
|
|
|
+ match = new SoccerMatch(rs.getInt(ID), getTeam(rs.getInt(HOME_TEAM_ID)), getTeam(rs.getInt(
|
|
|
AWAY_TEAM_ID)), rs.getFloat(ODDS_1), rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(
|
|
AWAY_TEAM_ID)), rs.getFloat(ODDS_1), rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(
|
|
|
HOME_SCORE),
|
|
HOME_SCORE),
|
|
|
- rs.getInt(AWAY_SCORE), LocalDateTime.parse(rs.getString("gameDate")),
|
|
|
|
|
|
|
+ rs.getInt(AWAY_SCORE), LocalDateTime.parse(rs.getString(GAME_DATE)),
|
|
|
rs.getString(SEASON));
|
|
rs.getString(SEASON));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1462,12 +1484,12 @@ public class GuiMysql extends Mysql {
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
|
- result.add(new SoccerMatch(rs.getInt("id"), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
|
|
|
|
+ result.add(new SoccerMatch(rs.getInt(ID), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
|
LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON)));
|
|
LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON)));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1533,8 +1555,8 @@ public class GuiMysql extends Mysql {
|
|
|
awayTeam.setTeamLeagueId(rs.getInt(Constants.LEAGUE_ID));
|
|
awayTeam.setTeamLeagueId(rs.getInt(Constants.LEAGUE_ID));
|
|
|
homeTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
homeTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
|
awayTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
awayTeam.setTeamLeague(rs.getString(LEAGUE_NAME));
|
|
|
- homeTeam.setCountryId(rs.getInt(Constants.COUNTRY_ID));
|
|
|
|
|
- awayTeam.setCountryId(rs.getInt(Constants.COUNTRY_ID));
|
|
|
|
|
|
|
+ homeTeam.setCountryId(rs.getInt(COUNTRY_ID));
|
|
|
|
|
+ awayTeam.setCountryId(rs.getInt(COUNTRY_ID));
|
|
|
homeTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
homeTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
|
awayTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
awayTeam.setCountryName(rs.getString(COUNTRY_NAME));
|
|
|
|
|
|
|
@@ -1568,7 +1590,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (final SQLException e) {
|
|
} catch (final SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1611,7 +1633,7 @@ public class GuiMysql extends Mysql {
|
|
|
ResultSet rs = stat.executeQuery();
|
|
ResultSet rs = stat.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- SoccerMatchAnalysis sma = new SoccerMatchAnalysis(new SoccerMatch(rs.getInt("id"),
|
|
|
|
|
|
|
+ SoccerMatchAnalysis sma = new SoccerMatchAnalysis(new SoccerMatch(rs.getInt(ID),
|
|
|
GuiMysql.getInstance().getTeam(rs.getInt(HOME_TEAM_ID)),
|
|
GuiMysql.getInstance().getTeam(rs.getInt(HOME_TEAM_ID)),
|
|
|
GuiMysql.getInstance().getTeam(rs.getInt(AWAY_TEAM_ID)),
|
|
GuiMysql.getInstance().getTeam(rs.getInt(AWAY_TEAM_ID)),
|
|
|
rs.getFloat(ODDS_1), rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE),
|
|
rs.getFloat(ODDS_1), rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE),
|
|
@@ -1621,7 +1643,7 @@ public class GuiMysql extends Mysql {
|
|
|
addTotalGoalStat(sma, limit, leagueId, rs.getInt("homeRes") - rs.getInt("awayRes"));
|
|
addTotalGoalStat(sma, limit, leagueId, rs.getInt("homeRes") - rs.getInt("awayRes"));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1657,7 +1679,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.execute();
|
|
stat.execute();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1705,7 +1727,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.execute();
|
|
stat.execute();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1754,7 +1776,7 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.execute();
|
|
stat.execute();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1772,12 +1794,12 @@ public class GuiMysql extends Mysql {
|
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
|
result.add(new SoccerMatchAnalysis(
|
|
result.add(new SoccerMatchAnalysis(
|
|
|
- new SoccerMatch(rs.getInt("id"), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
|
|
|
|
+ new SoccerMatch(rs.getInt(ID), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
|
LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON))));
|
|
LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON))));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1796,13 +1818,13 @@ public class GuiMysql extends Mysql {
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
Team homeTeam = getTeam(rs.getInt(HOME_TEAM_ID));
|
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
Team awayTeam = getTeam(rs.getInt(AWAY_TEAM_ID));
|
|
|
- result.add(new SoccerMatch(rs.getInt("id"), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
|
|
|
|
+ result.add(new SoccerMatch(rs.getInt(ID), homeTeam, awayTeam, rs.getFloat(ODDS_1),
|
|
|
rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
rs.getFloat(ODDS_X), rs.getFloat(ODDS_2), rs.getInt(HOME_SCORE), rs.getInt(AWAY_SCORE),
|
|
|
LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON)));
|
|
LocalDateTime.parse(rs.getString(GAME_DATE)), rs.getString(SEASON)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1818,14 +1840,17 @@ public class GuiMysql extends Mysql {
|
|
|
ResultSet rs = stat.executeQuery();
|
|
ResultSet rs = stat.executeQuery();
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
while (rs.next()) {
|
|
|
- result.add(new League(rs.getInt(Constants.ID), rs.getString("name"), rs.getInt("scoringDiffLastGame"),
|
|
|
|
|
- rs.getInt("scoringTotal"), rs.getInt("winLossRatioHomeAndAway"), rs.getInt("winLossRatio"),
|
|
|
|
|
- rs.getInt("drawDiffHomeAway"), rs.getInt("drawDiffTotalGoals"), rs.getInt("drawWinningForm"),
|
|
|
|
|
- rs.getInt("drawWinningFormHomeAway")));
|
|
|
|
|
|
|
+ League l = new League(rs.getInt(Constants.ID), rs.getString("name"), rs.getInt(SCORING_DIFF_LAST_GAME),
|
|
|
|
|
+ rs.getInt(SCORING_TOTAL), rs.getInt(WIN_LOSS_RATIO_HOME_AND_AWAY), rs.getInt(WIN_LOSS_RATIO),
|
|
|
|
|
+ rs.getInt(DRAW_DIFF_HOME_AWAY), rs.getInt(DRAW_DIFF_TOTAL_GOALS), rs.getInt(DRAW_WINNING_FORM),
|
|
|
|
|
+ rs.getInt(DRAW_WINNING_FORM_HOME_AWAY));
|
|
|
|
|
+ l.setCountyId(rs.getInt(COUNTRY_ID));
|
|
|
|
|
+ result.add(l);
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1874,13 +1899,13 @@ public class GuiMysql extends Mysql {
|
|
|
|
|
|
|
|
stat.execute();
|
|
stat.execute();
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void getScoringDiffLastGames(Percentages percentages, int leagueId, int lookback, int diff) {
|
|
|
|
|
|
|
+ public void addScoringDiffLastGamesToPercentage(Percentages percentages, int leagueId, int lookback, int diff) {
|
|
|
String sql = "SELECT homeWins, draws, awayWins FROM ScoringDiffLastGamesStatistics WHERE leagueId = ? AND " +
|
|
String sql = "SELECT homeWins, draws, awayWins FROM ScoringDiffLastGamesStatistics WHERE leagueId = ? AND " +
|
|
|
"lookback = ? and diff = ?";
|
|
"lookback = ? and diff = ?";
|
|
|
|
|
|
|
@@ -1897,13 +1922,13 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void getTotalGoalStat(Percentages percentages, int leagueId, int lookback, int diff) {
|
|
|
|
|
|
|
+ public void addTotalGoalStatToPercentage(Percentages percentages, int leagueId, int lookback, int diff) {
|
|
|
String sql = "SELECT homeWins, draws, awayWins FROM TotalGoalStatistics WHERE leagueId = ? AND " +
|
|
String sql = "SELECT homeWins, draws, awayWins FROM TotalGoalStatistics WHERE leagueId = ? AND " +
|
|
|
"lookback = ? and diff = ?";
|
|
"lookback = ? and diff = ?";
|
|
|
|
|
|
|
@@ -1920,7 +1945,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1943,7 +1968,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1966,7 +1991,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -1991,10 +2016,11 @@ public class GuiMysql extends Mysql {
|
|
|
stat.setInt(1, value);
|
|
stat.setInt(1, value);
|
|
|
stat.setInt(2, leagueId);
|
|
stat.setInt(2, leagueId);
|
|
|
|
|
|
|
|
|
|
+ System.out.println("Updating league setting " + setting + " from " + oldValue + " to " + value);
|
|
|
int res = stat.executeUpdate();
|
|
int res = stat.executeUpdate();
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
}finally {
|
|
}finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -2017,7 +2043,7 @@ public class GuiMysql extends Mysql {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -2040,7 +2066,7 @@ public class GuiMysql extends Mysql {
|
|
|
matches.add(new SoccerMatch(rs));
|
|
matches.add(new SoccerMatch(rs));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -2058,7 +2084,7 @@ public class GuiMysql extends Mysql {
|
|
|
matches.add(new SoccerMatch(rs));
|
|
matches.add(new SoccerMatch(rs));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
@@ -2079,11 +2105,33 @@ public class GuiMysql extends Mysql {
|
|
|
matches.add(new SoccerMatch(rs));
|
|
matches.add(new SoccerMatch(rs));
|
|
|
}
|
|
}
|
|
|
} catch (SQLException e) {
|
|
} catch (SQLException e) {
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
|
+ LOG.error(SQL_ERROR,e);
|
|
|
} finally {
|
|
} finally {
|
|
|
closeConnection();
|
|
closeConnection();
|
|
|
}
|
|
}
|
|
|
return matches;
|
|
return matches;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public void updateScoringTotalResults(int leagueId, int bestHomeWinLookback, int bestAwayWinLookback, int bestDrawLookback, String tableColumnName) {
|
|
|
|
|
+ String sql = "INSERT INTO LeagueRatings (leagueId, homeValue, awayValue, drawValue, statisticName) VALUES (?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE homeValue = ?, awayValue = ?, drawValue = ?";
|
|
|
|
|
+
|
|
|
|
|
+ try (PreparedStatement stat = getConnection().prepareStatement(sql)) {
|
|
|
|
|
+ stat.setInt(1, leagueId);
|
|
|
|
|
+ stat.setInt(2, bestHomeWinLookback);
|
|
|
|
|
+ stat.setInt(3, bestAwayWinLookback);
|
|
|
|
|
+ stat.setInt(4, bestDrawLookback);
|
|
|
|
|
+ stat.setString(5, tableColumnName);
|
|
|
|
|
+ stat.setInt(6, bestHomeWinLookback);
|
|
|
|
|
+ stat.setInt(7, bestAwayWinLookback);
|
|
|
|
|
+ stat.setInt(8, bestDrawLookback);
|
|
|
|
|
+
|
|
|
|
|
+ stat.executeUpdate();
|
|
|
|
|
+
|
|
|
|
|
+ } catch (SQLException e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ LOG.error(SQL_ERROR, e);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ closeConnection();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|