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

@ -208,12 +208,7 @@ static int _tf_command_import(const char* file, int argc, char* argv[])
return 2;
}
sqlite3* db = NULL;
if (args.db_path)
{
sqlite3_open(args.db_path, &db);
}
tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, db);
tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, args.db_path);
if (extra_count)
{
for (int i = 0; i < extra_count; i++)
@ -228,10 +223,6 @@ static int _tf_command_import(const char* file, int argc, char* argv[])
tf_ssb_import(ssb, args.user, "apps");
}
tf_ssb_destroy(ssb);
if (db)
{
sqlite3_close(db);
}
if (extras)
{
@ -277,12 +268,7 @@ static int _tf_command_export(const char* file, int argc, char* argv[])
}
return 2;
}
sqlite3* db = NULL;
if (args.db_path)
{
sqlite3_open(args.db_path, &db);
}
tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, db);
tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, args.db_path);
if (extra_count)
{
for (int i = 0; i < extra_count; i++)
@ -312,10 +298,6 @@ static int _tf_command_export(const char* file, int argc, char* argv[])
}
}
tf_ssb_destroy(ssb);
if (db)
{
sqlite3_close(db);
}
if (extras)
{