Example #1
0
  private Cursor getUserByMovieIDAndFavorite(Uri uri, String[] projection, String sortOrder) {
    String movieID = MovieContract.UserEntry.getMovieIDFromUri(uri);
    boolean favorite = MovieContract.UserEntry.getFavoriteFromUri(uri);

    return sUserByMovieIDQueryBuilder.query(
        mOpenHelper.getReadableDatabase(),
        projection,
        sMovieIDWithFavoriteSelection,
        new String[] {movieID, Boolean.toString(favorite).toUpperCase()},
        null,
        null,
        sortOrder);
  }
Example #2
0
  private Cursor getUserByMovieID(Uri uri, String[] projection, String sortOrder) {
    String movieID = MovieContract.UserEntry.getMovieIDFromUri(uri);
    boolean favorite = MovieContract.UserEntry.getFavoriteFromUri(uri);

    String[] selectionArgs;
    String selection;

    if (favorite == false) {
      selection = sMovieIDSelection;
      selectionArgs = new String[] {movieID};
    } else {
      selectionArgs = new String[] {movieID, Boolean.toString(favorite).toUpperCase()};
      selection = sMovieIDWithFavoriteSelection;
    }

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