Add saving of UUIDs (used in the UUID Fetcher update task)

This commit is contained in:
SLiPCoR 2014-07-23 11:05:27 +02:00 committed by TfT_02
parent 83c8d3cdb9
commit 4524a3e437

View File

@ -501,9 +501,40 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
public boolean saveUserUUID(String userName, UUID uuid) { public boolean saveUserUUID(String userName, UUID uuid) {
if (!checkConnected()) {
// return false
return false; return false;
} }
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(
"UPDATE `" + tablePrefix + "users` SET "
+ " uuid = ? WHERE user = ?");
statement.setString(1, uuid.toString());
statement.setString(2, userName);
statement.execute();
return true;
}
catch (SQLException ex) {
printErrors(ex);
return false;
}
finally {
if (statement != null) {
try {
statement.close();
}
catch (SQLException e) {
// Ignore
}
}
}
// Problem, nothing was returned
}
/** /**
* Check connection status and re-establish if dead or stale. * Check connection status and re-establish if dead or stale.
* <p/> * <p/>