Guest User

Untitled

a guest
Jan 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. String INSERT_QUERY="INSERT INTO testDb (rid , aid , created_at, expiry_time, strings , strings) VALUES"
  2.  
  3. private JsonArray preparedParameters(){
  4. //JsonArray params = new JsonArray();
  5. DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
  6. return new JsonArray()
  7. .add(device.getRecordId().toString())
  8. .add( device.getAccountId())
  9. .add(dateTimeFormat.format(device.getCreatedAt()))
  10. .add(dateTimeFormat.format(device.getExpiresAt()))
  11. .add( device.getEnrollmentId())
  12. .add(device.getHashedEnrollmentId());
  13. }
  14.  
  15. try (SQLConnection connection = connectionResult.result()) {
  16. connection.updateWithParams(INSERT_QUERY,preparedParameters() ,queryRes -> {
  17. if (queryRes.succeeded()) {
  18. booleanFuture.complete(true);
  19. } else {
  20. booleanFuture.complete(false);
  21. }
  22. });
  23. } catch (Exception e) {
  24.  
  25. booleanFuture.complete(false);
  26. }
  27.  
  28. The query contains 0 parameters but you gave it 6 ("sda","sda",2018-01-22 20:23:26,2018-02-21 20:23:26,"sda","sda")
Add Comment
Please, Sign In to add comment