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

Commit f81ec953 authored by Steve Kondik's avatar Steve Kondik
Browse files

Revert forced WAL mode for SQLite databases.

This causes issues for apps that do backups by copying the raw .db file
to external storage without copying the additional files needed for WAL.

Change-Id: I4edbc60deb07962e86a8d8b92876d2cd5b709701
parent 7edf414e
Loading
Loading
Loading
Loading
+0 −18
Original line number Original line Diff line number Diff line
@@ -101,8 +101,6 @@ static void dbopen(JNIEnv* env, jobject object, jstring pathString, jint flags)
    sqlite3_stmt * statement = NULL;
    sqlite3_stmt * statement = NULL;
    char const * path8 = env->GetStringUTFChars(pathString, NULL);
    char const * path8 = env->GetStringUTFChars(pathString, NULL);
    int sqliteFlags;
    int sqliteFlags;
    // Error code handling for SQLite exec
    char* zErrMsg = NULL;


    // register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
    // register the logging func on sqlite. needs to be done BEFORE any sqlite3 func is called.
    registerLoggingFunc(path8);
    registerLoggingFunc(path8);
@@ -123,22 +121,6 @@ static void dbopen(JNIEnv* env, jobject object, jstring pathString, jint flags)
        goto done;
        goto done;
    }
    }


    // Configure databases to run in WAL mode.
    err = sqlite3_exec(handle,"PRAGMA journal_mode = WAL;",
                       NULL, NULL,&zErrMsg);
    if (SQLITE_OK == err) {
        // Set autocheckpoint = 100 pages
        err = sqlite3_wal_autocheckpoint(handle,
                                         100);
        if (SQLITE_OK != err) {
            LOGE("sqlite3_exec to set WAL autocheckpoint failed\n");
            throw_sqlite3_exception(env, handle);
            goto done;
        }
    } else {
       LOGE("sqlite3_exec to set journal_mode = WAL failed\n");
    }

    // The soft heap limit prevents the page cache allocations from growing
    // The soft heap limit prevents the page cache allocations from growing
    // beyond the given limit, no matter what the max page cache sizes are
    // beyond the given limit, no matter what the max page cache sizes are
    // set to. The limit does not, as of 3.5.0, affect any other allocations.
    // set to. The limit does not, as of 3.5.0, affect any other allocations.