Frage

if SQLiteDatabase.isDatabaseIntegrityOK() returns false, how do i get access to the 1-100 lines of logs the database is supposed to return?

I want to display the results of the integrity check in my Android app.

Thanks!

War es hilfreich?

Lösung

Just execute the command yourself, and pretend that it's a SELECT:

Cursor cursor = db.rawQuery("PRAGMA integrity_check", null);
while (cursor.moveToNext()) {
    String s = cursor.getString(0);
    ...
}

Andere Tipps

Alternative using Android's DatabaseUtils:

StringBuilder sb = new StringBuilder();
DatabaseUtils.dumpCursor(db.rawQuery("PRAGMA integrity_check", null), sb);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top