Exemplo n.º 1
0
 @Override
 protected Void doInBackground(Void... params) {
   CreateConnection connection = new CreateConnection();
   Log.v(TAG, "Récupération des images...");
   int result = connection.updateShowsPicture();
   publishProgress(result);
   return (null);
 }
Exemplo n.º 2
0
  public static ArrayList<Candidates> getCandidates(
      String fname, String lname, String id, String party, String region) {
    connection = CreateConnection.getConnection();
    String idquery = "";
    if (id.length() > 0) {
      int candidate_id = Integer.parseInt(id);
      idquery = "AND candidate_id LIKE '" + candidate_id + "'";
    }
    ArrayList<Candidates> candidateList = new ArrayList<Candidates>();
    try {
      Statement statement = connection.createStatement();
      String select =
          "select * from candidateInfo WHERE first_name LIKE \""
              + fname
              + "%\" AND last_name LIKE \""
              + lname
              + "%\" AND region LIKE \""
              + region
              + "%\" AND party_name LIKE \""
              + party
              + "%\""
              + idquery;
      ResultSet rs = statement.executeQuery(select);
      while (rs.next()) {
        Candidates candidate = new Candidates();
        candidate.setId(rs.getInt("candidate_id"));
        candidate.setFirst_name(rs.getString("first_name"));
        candidate.setLast_name(rs.getString("last_name"));
        candidate.setParty(rs.getString("party_name"));
        candidate.setRegion(rs.getString("region"));
        candidateList.add(candidate);
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }

    return candidateList;
  }