From 867ada6657eb2930574a2a60c8e2e153c85cab76 Mon Sep 17 00:00:00 2001 From: Kane York Date: Sun, 30 Jun 2013 20:23:34 -0700 Subject: [PATCH] Specify returning of generated keys before using them This is a herp derp fix --- .../java/com/gmail/nossr50/database/SQLDatabaseManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index 54468fdc0..2361fb43f 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -302,7 +302,7 @@ public final class SQLDatabaseManager implements DatabaseManager { PreparedStatement statement = null; try { - statement = connection.prepareStatement("INSERT INTO " + tablePrefix + "users (user, lastlogin) VALUES (?, ?)"); + statement = connection.prepareStatement("INSERT INTO " + tablePrefix + "users (user, lastlogin) VALUES (?, ?)", Statement.RETURN_GENERATED_KEYS); statement.setString(1, playerName); statement.setLong(2, System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR); statement.execute(); @@ -1179,4 +1179,4 @@ public final class SQLDatabaseManager implements DatabaseManager { mcMMO.p.getLogger().severe("SQLState: " + ex.getSQLState()); mcMMO.p.getLogger().severe("VendorError: " + ex.getErrorCode()); } -} \ No newline at end of file +}