Java:
public void aa(String username) {
int zahl = 0;
String valid = "Select games_won FROM " + tableName + " where name = ?";
String update = "Update " + tableName + " set games_won = ? where name = ?";
System.out.println("aaa");
try (Connection connection = dataBaseConnection.getConnection(); PreparedStatement statement = connection.prepareStatement(valid)) {
statement.setString(1, username);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()){
zahl = Integer.parseInt(resultSet.getString("games_won"));
}
} catch (SQLException e) {
LOG.debug("Connection failure: {}", e.getMessage());
}
zahl++;
if(zahl > 0){
try (Connection connection = dataBaseConnection.getConnection(); PreparedStatement statement = connection.prepareStatement(update)) {
statement.setInt(1, zahl);
statement.setString(2, username);
statement.executeUpdate();
} catch (SQLException e) {
LOG.debug("Connection failure: {}", e.getMessage());
}
}
}