I'm encountering a runtime assertion failure when trying to execute a SQLite query using sqlite3_exec in Xcode 26. The error occurs specifically when attempting to set WAL (Write-Ahead Logging) mode and other database configurations.
Here is the code snippet that causes the problem:
NSString *sql = @"pragma journal_mode = wal; pragma synchronous = normal; create table if not exists manifest (key text, filename text, size integer, inline_data blob, modification_time integer, last_access_time integer, extended_data blob, primary key(key)); create index if not exists last_access_time_idx on manifest(last_access_time);";
char *error = NULL;
sqlite3_exec(_db, sql.UTF8String, NULL, NULL, &error);
When this code executes, it triggers the following assertion failure:
An abort signal terminated the process. Such crashes often happen because of an uncaught exception or unrecoverable error or calling the abort() function.
Assertion failed: (0), function checkWalModeFromQuery, file SQLiteDatabaseTracking.cpp, line 942.
I tried disabling WAL mode, but it doesn’t seem to take effect. I removed pragma journal_mode = wal; pragma synchronous = normal;
sqlite_exec
for the pragma. Give that a try and see if it works for you.