Пример #1
0
  public Bug getBugById(long id) {

    String sql =
        "SELECT * FROM "
            + Bugtracking.IssueEntry.TABLE_ISSUE
            + " WHERE "
            + Bugtracking.IssueEntry.ID
            + " = "
            + id;
    Cursor cursor = this.db.rawQuery(sql, null);

    if (cursor != null) {
      cursor.moveToFirst();
    }
    Bug bug = new Bug();
    bug.setId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.ID)));
    bug.setDevId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.DEVID)));
    bug.setTitle(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.TITLE)));
    bug.setCategory(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.CATEGORY)));
    bug.setDate(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DATE)));
    bug.setDescription(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DESCRIPTION)));
    bug.setEffects(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.EFFECT)));
    bug.setPriority(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.PRIORITY)));
    bug.setProjectId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.PROID)));
    bug.setReference(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REFERENCE)));
    bug.setReproduce(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REPRODUCE)));
    bug.setState(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.STATE)));

    return bug;
  }
Пример #2
0
  public List<Bug> getAllIssueByProjectState(long projectid, String state) {
    List<Bug> bugs = new ArrayList<>();
    String sql =
        "SELECT * FROM "
            + Bugtracking.IssueEntry.TABLE_ISSUE
            + " WHERE "
            + Bugtracking.IssueEntry.PROID
            + " = "
            + projectid
            + " AND "
            + Bugtracking.IssueEntry.STATE
            + " = '"
            + state
            + "'";

    Cursor cursor = this.db.rawQuery(sql, null);
    if (cursor.moveToFirst()) {
      do {
        Bug bug = new Bug();
        bug.setId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.ID)));
        bug.setDevId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.DEVID)));
        bug.setTitle(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.TITLE)));
        bug.setCategory(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.CATEGORY)));
        bug.setDate(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DATE)));
        bug.setDescription(
            cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.DESCRIPTION)));
        bug.setEffects(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.EFFECT)));
        bug.setPriority(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.PRIORITY)));
        bug.setProjectId(cursor.getInt(cursor.getColumnIndex(Bugtracking.IssueEntry.PROID)));
        bug.setReference(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REFERENCE)));
        bug.setReproduce(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.REPRODUCE)));
        bug.setState(cursor.getString(cursor.getColumnIndex(Bugtracking.IssueEntry.STATE)));
        bugs.add(bug);
      } while (cursor.moveToNext());
    }
    return bugs;
  }