Show sqlite compile options

This commit is contained in:
M66B
2022-09-24 13:00:18 +02:00
parent 41e8c3b950
commit e87198c24a
2 changed files with 13 additions and 5 deletions

View File

@@ -138,7 +138,8 @@ public abstract class DB extends RoomDatabase {
"page_count", "page_size", "max_page_count", "freelist_count",
"cache_size", "cache_spill",
"soft_heap_limit", "hard_heap_limit", "mmap_size",
"foreign_keys", "auto_vacuum"
"foreign_keys", "auto_vacuum",
"compile_options"
));
@Override
@@ -468,9 +469,16 @@ public abstract class DB extends RoomDatabase {
// https://www.sqlite.org/pragma.html
for (String pragma : DB_PRAGMAS)
try (Cursor cursor = db.query("PRAGMA " + pragma + ";")) {
Log.i("Get PRAGMA " + pragma + "=" + (cursor.moveToNext() ? cursor.getString(0) : "?"));
}
if (!"compile_options".equals(pragma) || BuildConfig.DEBUG)
try (Cursor cursor = db.query("PRAGMA " + pragma + ";")) {
boolean has = false;
while (cursor.moveToNext()) {
has = true;
Log.i("Get PRAGMA " + pragma + "=" + (cursor.isNull(0) ? "<null>" : cursor.getString(0)));
}
if (!has)
Log.i("Get PRAGMA " + pragma + "=<?>");
}
if (BuildConfig.DEBUG && false) {
db.execSQL("DROP TRIGGER IF EXISTS `attachment_insert`");