Fix SQL issue
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-10-24 22:44:12 +02:00
parent 5d5e6a5cfb
commit 6298697169

View File

@ -336,7 +336,7 @@ public class DatabaseManager
if(!isInTable(playerName)) return -1; if(!isInTable(playerName)) return -1;
String query = "SELECT ? FROM players " + String query = "SELECT %param% FROM players " +
"WHERE player=? " + "WHERE player=? " +
"LIMIT 1"; "LIMIT 1";
@ -348,11 +348,12 @@ public class DatabaseManager
String priorityStr = ""; String priorityStr = "";
if(priority == 0) priorityStr = "main_pronoun_id"; if(priority == 0) priorityStr = "main_pronoun_id";
else if(priority == 1) priorityStr = "secondary_pronoun_id"; else if(priority == 1) priorityStr = "secondary_pronoun_id";
query = query.replace("%param%", priorityStr);
try(PreparedStatement pStatement = dbConnection.prepareStatement(query)) { try(PreparedStatement pStatement = dbConnection.prepareStatement(query)) {
pStatement.setString(1, priorityStr); pStatement.setString(1, playerName);
pStatement.setString(2, playerName);
ResultSet rSet = pStatement.executeQuery(); ResultSet rSet = pStatement.executeQuery();
if(rSet.isClosed()) return -1; if(rSet.isClosed()) return -1;