Merge pull request #3076 from jmakovicka/fix-sqlite-mode

Fix SQLite open flags
This commit is contained in:
vshcherb 2016-09-15 11:39:59 +02:00 committed by GitHub
commit cafb244a90

View file

@ -14,8 +14,9 @@ public class SQLiteAPIImpl implements SQLiteAPI {
@Override
public SQLiteConnection getOrCreateDatabase(String name, boolean readOnly) {
android.database.sqlite.SQLiteDatabase db = app.openOrCreateDatabase(name,
readOnly? SQLiteDatabase.OPEN_READONLY : (SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING), null);
android.database.sqlite.SQLiteDatabase db = SQLiteDatabase.openDatabase(app.getDatabasePath(name).getAbsolutePath(), null,
(readOnly? SQLiteDatabase.OPEN_READONLY : (SQLiteDatabase.OPEN_READWRITE | SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING))
| SQLiteDatabase.CREATE_IF_NECESSARY);
if(db == null) {
return null;
}