Пример #1
0
  @Override
  public boolean addUser(UserPOJO user, String password) {

    try {
      return uTable.insert(user, password);
    } catch (SQLException e) {
      Logger.getLogger(EmbeddedDB.class.getName()).log(Level.SEVERE, e.getMessage(), e);
    }
    return false;
  }
Пример #2
0
  @Override
  public UserPOJO connectUser(String id, String password) {

    try {
      Optional<UserPOJO> op = uTable.exist(id, password);
      return op.isPresent() ? op.get() : null;
    } catch (SQLException e) {
      Logger.getLogger(EmbeddedDB.class.getName()).log(Level.SEVERE, e.getMessage(), e);
    }
    return null;
  }
Пример #3
0
  @Override
  public boolean clear() {

    try {
      boolean bDelete = bTable.delete();
      boolean uDelete = uTable.delete();
      boolean cDelete = cTable.delete();
      return bDelete && uDelete && cDelete;
    } catch (SQLException e) {
      Logger.getLogger(EmbeddedDB.class.getName()).log(Level.SEVERE, e.getMessage(), e);
    }

    return false;
  }