lundi 21 mars 2016

Android SQLite Database getting effective row count?

I wonder that which way is more effective for getting row count.

Either the first way;

Cursor c = ourDatabase.rawQuery("SELECT * FROM " + DATABASE_NAME, null); return c.getCount();

Or the second way;

Cursor c = ourDatabase.rawQuery("SELECT COUNT(*) FROM " + DATABASE_NAME, null);
return c.getInt(0);

Aucun commentaire:

Enregistrer un commentaire