I try to read from the sqlitDB with the following query:
public ArrayList<ReminderNote> getAllRegexItems(String author) {
ArrayList<ReminderNote> results = new ArrayList<>();
Cursor cursor = this.getReadableDatabase().query(
REMINDER_NOTE_TABLE,
new String[]{KEY_ID, KEY_NOTE, KEY_AUTHOR}, Strings.isEmpty(author) ? null : KEY_AUTHOR + " = ?",
Strings.isEmpty(author) ? null : new String[]{"%" + author + "%"}, null, null, null);
is it OK to use the %
like i did?
If author is null or empty I want all the results to be fetched.
Unfortunately I get empty results set even though I added such entity beforehand.
and I can see non-empty results set when I execute:
Cursor cursor = this.getReadableDatabase().query(
REMINDER_NOTE_TABLE,
new String[]{KEY_ID, KEY_NOTE, KEY_AUTHOR}, null, null, null, null, null);
Aucun commentaire:
Enregistrer un commentaire