Use getDouble with SQL function AVG()

MySQL that restricts float being queried with getInt caused an
SQLException

All usages of getInt with AVG function replaced with
getDouble cast to int.

Affects issues:
- Fixed #1181
This commit is contained in:
Rsl1122 2019-10-19 00:06:46 +03:00
parent 55401c86c1
commit 68c845e71b
2 changed files with 4 additions and 4 deletions

View File

@ -231,7 +231,7 @@ public class PlayerCountQueries {
@Override
public Integer processResults(ResultSet set) throws SQLException {
return set.next() ? set.getInt("average") : 0;
return set.next() ? (int) set.getDouble("average") : 0;
}
});
};
@ -389,7 +389,7 @@ public class PlayerCountQueries {
@Override
public Integer processResults(ResultSet set) throws SQLException {
return set.next() ? set.getInt("average") : 0;
return set.next() ? (int) set.getDouble("average") : 0;
}
});
};

View File

@ -234,7 +234,7 @@ public class PingQueries {
serverUUID,
set.getInt("minPing"),
set.getInt("maxPing"),
set.getInt("avgPing")
(int) set.getDouble("avgPing")
);
pingByGeolocation.put(set.getString(GeoInfoTable.GEOLOCATION), ping);
}
@ -285,7 +285,7 @@ public class PingQueries {
null,
set.getInt("minPing"),
set.getInt("maxPing"),
set.getInt("avgPing")
(int) set.getDouble("avgPing")
);
pingByGeolocation.put(set.getString(GeoInfoTable.GEOLOCATION), ping);
}