I am trying to test if a sqlite database is empty or not. I've read stackoverflow posts and many recommend using rawQuery and getCount() methods. Others recommend using DatabaseUtils.longForQuery and DatabaseUtils.queryNumEntries.
I am looking for speed since the number of rows in the database is large. I am looking for quick test to see if the number of rows is zero. If not, it is because there are 1 or more rows in the database. Would there be a method that aborts the count after 1 row is identified rather than counting all of the rows? If not, any thoughts on getCount vs. DatabaseUtils?
Aucun commentaire:
Enregistrer un commentaire