Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8208529c authored by Vasu Nori's avatar Vasu Nori Committed by Android (Google) Code Review
Browse files

Merge "journal_mode should be set only on non-memory databases"

parents ab8aa51a 194897da
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -956,11 +956,14 @@ public class SQLiteDatabase extends SQLiteClosable {
        }
        sqliteDatabase.setPageSize(sBlockSize);

        // set journal_mode to truncate
        // set journal_mode to truncate for non-memory databases
        if (!path.equalsIgnoreCase(":memory:")) {
            String s = DatabaseUtils.stringForQuery(sqliteDatabase, "PRAGMA journal_mode=TRUNCATE",
                    null);
            if (!s.equalsIgnoreCase("TRUNCATE")) {
            Log.e(TAG, "setting journal_mode to TRUNCATE failed");
                Log.e(TAG, "setting journal_mode to TRUNCATE failed for db: " + path +
                        " (on pragma set journal_mode, sqlite returned:" + s);
            }
        }

        // add this database to the list of databases opened in this process