public void updatePlayer(Player player) throws SQLException { PreparedStatement pstm = connection.prepareStatement( "UPDATE player SET transfer_list = ?, national = ? WHERE id_player = ?"); pstm.setInt(1, player.getTransferList()); pstm.setInt(2, player.getNational()); pstm.setInt(3, player.getId()); pstm.executeUpdate(); pstm.close(); }
public void addPlayer(Player player) throws SQLException { PreparedStatement pstm = connection.prepareStatement( "INSERT INTO player(id_player,name,surname,countryfrom, id_club_fk, status, national, transfer_list, youth_team_id, height) VALUES (?, ?, ?, ?, ?, 0, ?, ?, ?, ?)"); pstm.setInt(1, player.getId()); pstm.setString(2, player.getName()); pstm.setString(3, player.getSurname()); pstm.setInt(4, player.getCountryfrom()); pstm.setInt(5, player.getTeamId()); pstm.setInt(6, player.getNational()); pstm.setInt(7, player.getTransferList()); pstm.setInt(8, player.getYouthTeamId()); pstm.setInt(9, player.getHeight()); pstm.executeUpdate(); pstm.close(); }