mardi 7 juillet 2015

Getter that returns a query

What I'm attempting to do is create a getter method in a SQL table class.

I currently have this (would prefer it as .query, but can't seem to figure that out yet):

public static Cursor getAllArchived(SQLiteDatabase readOnlyDatabase) {
        return readOnlyDatabase.rawQuery("SELECT * FROM rss_items WHERE is_archived = 1 AND id = ?", new String[] {});
}

I'm calling it by doing this :

Cursor allArchved = RssItemTable.getAllArchived(databaseOpenHelper.getReadableDatabase());

The intended function is that I could call that getter method and it would provide me a list of what is currently archived.

Am I doing this right (using a Cursor and creating the .rawQuery)?

Aucun commentaire:

Enregistrer un commentaire