Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public void getPlayer(String name) {
  2. PreparedStatement statement = null;
  3. Connection connection = null;
  4. try {
  5. String select = ("SELECT * FROM money WHERE UUID=?");
  6. connection = hikariDataSource.getConnection();
  7. statement = connection.prepareStatement(select);
  8. statement.setString(1, getUuid(name));
  9. ResultSet result = statement.executeQuery();
  10. result.next();
  11. if (playerExist(name) != true) {
  12. String update = "INSERT INTO money(UUID,NAME,TOKENS) VALUE (?,?,?)";
  13. PreparedStatement pre = null;
  14. Connection con = null;
  15. con = hikariDataSource.getConnection();
  16. pre = con.prepareStatement(update);
  17. pre.setString(1, getUuid(name));
  18. pre.setString(2, name);
  19. pre.setString(3, String.valueOf(0));
  20. pre.executeUpdate();
  21. }
  22. } catch (SQLException e) {
  23. e.printStackTrace();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement