Allow running read-only sqlite queries from libuv worker threads. Needs so much more testing.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4172 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-02-08 01:29:44 +00:00
parent ac60be14a5
commit b35d74ce36
7 changed files with 332 additions and 93 deletions

View File

@ -52,11 +52,16 @@ static bool _tf_ssb_db_has_rows(sqlite3* db, const char* query)
return found;
}
static void _tf_ssb_db_init_internal(sqlite3* db)
{
_tf_ssb_db_exec(db, "PRAGMA journal_mode = WAL");
_tf_ssb_db_exec(db, "PRAGMA synchronous = NORMAL");
}
void tf_ssb_db_init(tf_ssb_t* ssb)
{
sqlite3* db = tf_ssb_get_db(ssb);
_tf_ssb_db_exec(db, "PRAGMA journal_mode = WAL");
_tf_ssb_db_exec(db, "PRAGMA synchronous = NORMAL");
_tf_ssb_db_init_internal(db);
_tf_ssb_db_exec(db,
"CREATE TABLE IF NOT EXISTS messages ("
" author TEXT,"