Beispiel #1
0
 public boolean update(Team team) {
   try {
     this.connect
         .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)
         .executeUpdate(
             "UPDATE teams SET te_points =" + team.getPoints() + "WHERE te_id = " + team.getID());
   } catch (SQLException e) {
     e.printStackTrace();
     return false;
   }
   return true;
 }
Beispiel #2
0
 public boolean create(Team team) {
   try {
     this.connect
         .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)
         .executeUpdate(
             "INSERT INTO teams VALUES (" + team.getID() + "," + team.getPoints() + ")");
   } catch (SQLException e) {
     e.printStackTrace();
     return false;
   }
   return true;
 }
Beispiel #3
0
  public ArrayList<Player> getPlayerList(Team team) {

    ArrayList<Player> players = new ArrayList<>();

    try {
      Statement state =
          this.connect.createStatement(
              ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

      ResultSet result =
          state.executeQuery("SELECT pl_id FROM players WHERE te_id =" + team.getID());

      PlayerDAO playerDAO = (PlayerDAO) DAOFactory.getPlayerDAO();

      while (result.next()) {
        players.add(playerDAO.find(result.getInt(1)));
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return players;
  }