Exemple #1
0
  /** @hide */
  public <T> T fetchEntry(int entryId, QueryEvaluator<T> qe, T defaultResult, Object... params) {
    Cursor cursor = null;

    try {
      cursor = query(getFieldNames(), "entry=" + entryId);
      if (cursor != null) return qe.evaluate(cursor, defaultResult, params);
    } catch (SQLiteException ex) {
    } finally {
      if (cursor != null) cursor.close();
    }

    return defaultResult;
  }
Exemple #2
0
  /** @hide */
  public <T> T rawQuery(
      String sql, String[] selectionArgs, QueryEvaluator<T> qe, T defaultResult, Object... params) {
    Cursor cursor = null;

    try {
      cursor = rawQuery(sql, selectionArgs);
      if (cursor != null) return qe.evaluate(cursor, defaultResult, params);
    } catch (SQLiteException ex) {
    } finally {
      if (cursor != null) cursor.close();
    }

    return defaultResult;
  }