Example #1
0
  /**
   * Supprime la ligne de la bdd donnée d'un client, s'il s'agit de sa dernière BDD : on supprime la
   * ligne associée et on rajoute une nouvelle avec : bdd = "_", ip = "_" , et port = 0
   */
  public static Boolean deleteDbClient(Connection con, String email, String bdd) {
    Boolean notexist = false;
    try {
      if (existClient(con, email)) {
        Statement smt = con.createStatement();
        String currentPwd = DatabaseManager.hisPassword(con, email);
        smt.executeUpdate(
            "DELETE FROM members WHERE email = '" + email + "' and bdd = '" + bdd + "'");
        smt.executeUpdate(
            "DELETE FROM mybdd WHERE email = '" + email + "' and bdd = '" + bdd + "'");
        notexist = true;
        if (!existClient(con, email)) {
          DatabaseManager.createClient(con, email, currentPwd, 0, "_", "_", 0);
        }
      }

    } catch (SQLException ex) {
      Logger.getLogger(DatabaseManager.class.getName()).log(Level.SEVERE, null, ex);
    }
    return notexist;
  }