Last active
August 29, 2015 14:21
-
-
Save sax1johno/34656c0155b3334fbf2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Cursor fetchRow (SQLiteDatabase readOnlyDatabase, long rowId, boolean archived, boolean isFavorite, String title) { | |
StringBuilder sqlStatement = new StringBuilder(); | |
sqlStatement.append("SELECT * FROM " + COLUMN_RSS_FEED + " WHERE rowId = " + rowId); | |
if (archived != null) { | |
sqlStatement.append(" AND " + COLUMN_ARCHIVED + " = " + archived); | |
} | |
if (isFavorite) { | |
sqlStatement.append(" AND " + COLUMN_FAVORITE + " = " + isFavorite); | |
} | |
if (title) { | |
sqlStatement.append(" AND " + COLUMN_TITLE + " = " + title); | |
} | |
sqlStatement.append(";"); | |
return readOnlyDatabase.rawQuery(sqlStatement.toString()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment