I'm trying to get values from a database. (I checked manually already and know that the values in the database aren't actually null) My Query is "SELECT * FROM LsGamesPlayers WHERE player_uuid = ? AND game = ?;". And I'm using the following code to loop through the columns and get the values (the if statements with the boolean isLifetime aren't important for this case).
ResultSet set = prep.executeQuery();
set.next();
ResultSetMetaData data = set.getMetaData();
int count = data.getColumnCount();
ArrayList<StatUnit<?>> units = new ArrayList<>();
for(int i = 1; i <= count; i++){
Function<ResultSet, ?> fun = StatItem.getMethod(data.getColumnTypeName(i), data.getColumnLabel(i));
if(isLifetime && data.getColumnLabel(i).equals("game")){
units.add(new StatUnit<>(p, data.getColumnLabel(i), gameId, "ls", isLifetime));
continue;
}else if(isLifetime && data.getColumnLabel(i).equals("was_winner")){
units.add(new StatUnit<>(p, data.getColumnLabel(i), countGames(p, true), "ls", isLifetime));
continue;
}
if(isLifetime && fun.apply(set) instanceof Integer){
units.add(new StatUnit<>(p, data.getColumnLabel(i), sumColumns(data.getColumnLabel(i), p), "ls", isLifetime));
continue;
}
units.add(new StatUnit<>(p, data.getColumnLabel(i), fun.apply(set), "ls", isLifetime));
set.next();
}
Though the values it gets are alway null and I don't know why.