1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Fix for duplicate keys for userids

executeUpdate -> execute

Fixes #898
This commit is contained in:
montlikadani 2020-08-26 17:40:15 +02:00
parent d08dbedb56
commit b776c5b4a8

View File

@ -870,7 +870,7 @@ public abstract class JobsDAO {
prestt.setString(2, playerName);
prestt.setLong(3, System.currentTimeMillis());
prestt.setInt(4, 0);
prestt.executeUpdate();
prestt.execute();
res2 = prestt.getGeneratedKeys();
int id = 0;
@ -1916,15 +1916,16 @@ public abstract class JobsDAO {
+ "` FROM `" + DBTables.UsersTable.getTableName() + "` WHERE `" + UserTableFields.player_uuid.getCollumn() + "` = ?;");
prest.setString(1, player.getUniqueId().toString());
res = prest.executeQuery();
res.next();
int id = res.getInt("id");
player.setUserId(id);
Jobs.getPlayerManager().addPlayerToMap(new PlayerInfo(
player.getName(),
id,
player.getUniqueId(),
player.getSeen(),
res.getInt(UserTableFields.donequests.getCollumn())));
if (res.next()) {
int id = res.getInt("id");
player.setUserId(id);
Jobs.getPlayerManager().addPlayerToMap(new PlayerInfo(
player.getName(),
id,
player.getUniqueId(),
player.getSeen(),
res.getInt(UserTableFields.donequests.getCollumn())));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
@ -2410,7 +2411,7 @@ public abstract class JobsDAO {
try {
prest = conn.prepareStatement("SELECT * FROM `" + DBTables.ExploreDataTable.getTableName() + "`;");
res = prest.executeQuery();
Set<Integer> missingWorlds = new HashSet<Integer>();
Set<Integer> missingWorlds = new HashSet<>();
while (res.next()) {
int worldId = res.getInt(ExploreDataTableFields.worldid.getCollumn());
JobsWorld jworld = Util.getJobsWorld(worldId);