Esempio n. 1
0
  private Cursor getWeatherByLocationSettingAndDate(
      Uri uri, String[] projection, String sortOrder) {
    String locationSetting = WeatherContract.WeatherEntry.getLocationSettingFromUri(uri);
    long date = WeatherContract.WeatherEntry.getDateFromUri(uri);

    return sWeatherByLocationSettingQueryBuilder.query(
        mOpenHelper.getReadableDatabase(),
        projection,
        sLocationSettingAndDaySelection,
        new String[] {locationSetting, Long.toString(date)},
        null,
        null,
        sortOrder);
  }
Esempio n. 2
0
  private Cursor getWeatherByLocationSetting(Uri uri, String[] projection, String sortOrder) {
    String locationSetting = WeatherContract.WeatherEntry.getLocationSettingFromUri(uri);
    long startDate = WeatherContract.WeatherEntry.getStartDateFromUri(uri);

    String[] selectionArgs;
    String selection;

    if (startDate == 0) {
      selection = sLocationSettingSelection;
      selectionArgs = new String[] {locationSetting};
    } else {
      selectionArgs = new String[] {locationSetting, Long.toString(startDate)};
      selection = sLocationSettingWithStartDateSelection;
    }

    return sWeatherByLocationSettingQueryBuilder.query(
        mOpenHelper.getReadableDatabase(),
        projection,
        selection,
        selectionArgs,
        null,
        null,
        sortOrder);
  }