diff --git a/app/src/main/java/eu/faircode/email/DB.java b/app/src/main/java/eu/faircode/email/DB.java index aed8aa6a91..1e1c8e0826 100644 --- a/app/src/main/java/eu/faircode/email/DB.java +++ b/app/src/main/java/eu/faircode/email/DB.java @@ -129,6 +129,15 @@ public abstract class DB extends RoomDatabase { private static final String[] DB_TABLES = new String[]{ "identity", "account", "folder", "message", "attachment", "operation", "contact", "certificate", "answer", "rule", "search", "log"}; + private static final String[] DB_PRAGMAS = new String[]{ + "synchronous", "journal_mode", + "wal_checkpoint", "wal_autocheckpoint", "journal_size_limit", + "page_count", "page_size", "max_page_count", "freelist_count", + "cache_size", "cache_spill", + "soft_heap_limit", "hard_heap_limit", "mmap_size", + "foreign_keys" + }; + @Override public void init(@NonNull DatabaseConfiguration configuration) { // https://www.sqlite.org/pragma.html#pragma_wal_autocheckpoint @@ -414,13 +423,7 @@ public abstract class DB extends RoomDatabase { } // https://www.sqlite.org/pragma.html - for (String pragma : new String[]{ - "synchronous", "journal_mode", - "wal_checkpoint", "wal_autocheckpoint", "journal_size_limit", - "page_count", "page_size", "max_page_count", "freelist_count", - "cache_size", "cache_spill", - "soft_heap_limit", "hard_heap_limit", "mmap_size", - "foreign_keys"}) + for (String pragma : DB_PRAGMAS) try (Cursor cursor = db.query("PRAGMA " + pragma + ";")) { Log.i("Get PRAGMA " + pragma + "=" + (cursor.moveToNext() ? cursor.getString(0) : "?")); }