How do I get the row count of a query in Android using SQLite? It seems my following method does not work.
public int getFragmentCountByMixId(int mixId) { int count = 0; SQLiteDatabase db = dbOpenHelper.getWritableDatabase(); Cursor cursor = db.rawQuery( "select count(*) from downloadedFragement where mixId=?", new String[]{String.valueOf(mixId)}); while(cursor.moveToFirst()){ count = cursor.getInt(0); } return count; }
SQLite COUNT() function illustration As you can see clearly from the output, the result set includes NULL and duplicate rows. In this example, the COUNT(c) returns the number of non-null values. It counts the duplicate rows as separate rows.
Just click the column header. The status bar, in the lower-right corner of your Excel window, will tell you the row count. Do the same thing to count columns, but this time click the row selector at the left end of the row. If you select an entire row or column, Excel counts just the cells that contain data.
The max_page_count PRAGMA can be used to raise or lower this limit at run-time. The theoretical maximum number of rows in a table is 264 (18446744073709551616 or about 1.8e+19). This limit is unreachable since the maximum database size of 281 terabytes will be reached first.
Cursor.getCount()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With