Refactoring

pull/194/merge
M66B 3 years ago
parent e476a6f3bf
commit ec69dc6680

@ -129,6 +129,15 @@ public abstract class DB extends RoomDatabase {
private static final String[] DB_TABLES = new String[]{ private static final String[] DB_TABLES = new String[]{
"identity", "account", "folder", "message", "attachment", "operation", "contact", "certificate", "answer", "rule", "search", "log"}; "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 @Override
public void init(@NonNull DatabaseConfiguration configuration) { public void init(@NonNull DatabaseConfiguration configuration) {
// https://www.sqlite.org/pragma.html#pragma_wal_autocheckpoint // 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 // https://www.sqlite.org/pragma.html
for (String pragma : new String[]{ for (String pragma : DB_PRAGMAS)
"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"})
try (Cursor cursor = db.query("PRAGMA " + pragma + ";")) { try (Cursor cursor = db.query("PRAGMA " + pragma + ";")) {
Log.i("Get PRAGMA " + pragma + "=" + (cursor.moveToNext() ? cursor.getString(0) : "?")); Log.i("Get PRAGMA " + pragma + "=" + (cursor.moveToNext() ? cursor.getString(0) : "?"));
} }

Loading…
Cancel
Save