예제 #1
0
  private Cursor getGroupCursor(String strFilter) {
    StringBuilder sb =
        new StringBuilder(
            "SELECT *,COUNT("
                + IOContactTable._ID
                + ") AS "
                + IOContactTable.CONTACT_COUNT
                + " FROM "
                + IOContactTable.getInstance().TABLE_NAME);

    if (curFilter != null && curFilter.length() > 0) {
      sb.append(
          " WHERE ("
              + IOContactTable.SORT_KEY
              + " LIKE '"
              + strFilter
              + "' OR "
              + IOContactTable.EMAIL
              + " LIKE '"
              + strFilter
              + "')");
    }

    sb.append(" GROUP BY " + IOContactTable.GROUP_KEY + " ORDER BY " + IOContactTable.GROUP_KEY);

    Cursor csr = IOContactTable.getInstance().getCursor(sb.toString());
    return csr;
  }
예제 #2
0
  private Cursor getChildCursor(Cursor groupCursor, String strFilter) {
    String gkey = groupCursor.getString(groupCursor.getColumnIndex(IOContactTable.GROUP_KEY));

    StringBuilder childSql =
        new StringBuilder(
            "SELECT * FROM "
                + IOContactTable.getInstance().TABLE_NAME
                + " WHERE "
                + IOContactTable.GROUP_KEY
                + "='"
                + gkey
                + "'");

    if (strFilter != null && strFilter.length() > 0) {
      childSql.append(
          " AND ("
              + IOContactTable.SORT_KEY
              + " LIKE '"
              + strFilter
              + "' OR "
              + IOContactTable.EMAIL
              + " LIKE '"
              + strFilter
              + "')");
    }

    childSql.append(" ORDER BY " + IOContactTable.SORT_KEY);
    Cursor csr = IOContactTable.getInstance().getCursor(childSql.toString());
    return csr;
  }
예제 #3
0
  @Override
  public Cursor getAllDataCursor() {
    // TODO Auto-generated method stub
    StringBuilder sb =
        new StringBuilder("SELECT * FROM " + IOContactTable.getInstance().TABLE_NAME);

    if (curFilter != null && curFilter.length() > 0) {
      sb.append(
          " WHERE ("
              + IOContactTable.SORT_KEY
              + " LIKE '"
              + curFilter
              + "'"
              + " OR "
              + IOContactTable.EMAIL
              + " LIKE '"
              + curFilter
              + "')");
    }

    Cursor csr = IOContactTable.getInstance().getCursor(sb.toString());
    return csr;
  }