Can't change journal mode in SQLite on Android

1.2k Views Asked by At

I'm using Android 6.0 and SQLite 3.8.10.2 I have a problem with changing journal mode for my db connection.

Cursor cursor = null;
cursor = mDatabase.rawQuery("PRAGMA journal_mode", null);
Boolean d = cursor.moveToFirst();
String gg = cursor.getString(0);
cursor.close();

mDatabase.rawQuery("PRAGMA journal_mode=DELETE", null);

cursor = mDatabase.rawQuery("PRAGMA journal_mode", null);
Boolean dd = cursor.moveToFirst();
String xx = cursor.getString(0);
cursor.close();

First I check journal_mode and value is 'PERSIST' Then I set journal_mode=DELETE and check again, but value of xx variable is still PERSIST. I need to change journal_mode because I have to sync db between multiple devices.

Thanks

1

There are 1 best solutions below

3
On

It turns out that I have to write journal_mode=Delete instead of journal_mode=DELETE. Very strange, because documentation writes everything in capital letters.