From 507a62539d0844545c6690913977f468e4903e7d Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 15 Feb 2023 02:43:08 +0000 Subject: [PATCH] Fix exporting. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4177 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/ssb/app.js | 2 +- src/main.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/ssb/app.js b/apps/ssb/app.js index 0f957860..3698ffd0 100644 --- a/apps/ssb/app.js +++ b/apps/ssb/app.js @@ -47,7 +47,7 @@ tfrpc.register(async function closeConnection(id) { }); tfrpc.register(async function query(sql, args) { let result = []; - await ssb.sqlStream(sql, args, function callback(row) { + await ssb.sqlAsync(sql, args, function callback(row) { result.push(row); }); return result; diff --git a/src/main.c b/src/main.c index 105670be..e94be9db 100644 --- a/src/main.c +++ b/src/main.c @@ -84,6 +84,8 @@ const command_t k_commands[] = { { "private", _tf_command_private, "Check for private messages the SSB database (just an experiment)." }, }; +const char* k_db_path_default = "db.sqlite"; + struct backtrace_state* g_backtrace_state; void shedPrivileges() @@ -192,7 +194,7 @@ static int _tf_command_import(const char* file, int argc, char* argv[]) XOPT_NULLOPTION, }; - args_t args = { .user = "import" }; + args_t args = { .user = "import", .db_path = k_db_path_default }; const char** extras = NULL; int extra_count = 0; const char *err = NULL; @@ -253,7 +255,7 @@ static int _tf_command_export(const char* file, int argc, char* argv[]) XOPT_NULLOPTION, }; - args_t args = { .user = "core" }; + args_t args = { .user = "core", .db_path = k_db_path_default }; const char** extras = NULL; int extra_count = 0; const char *err = NULL; @@ -389,7 +391,7 @@ static int _tf_command_run(const char* file, int argc, char* argv[]) .http_port = 12345, .https_port = 12346, .ssb_port = 8009, - .db_path = "db.sqlite", + .db_path = k_db_path_default, }; const char** extras = NULL; int extra_count = 0; @@ -533,7 +535,7 @@ static int _tf_command_post(const char* file, int argc, char* argv[]) return 2; } - tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, NULL); + tf_ssb_t* ssb = tf_ssb_create(NULL, NULL, k_db_path_default); tf_ssb_broadcast_listener_start(ssb, false); tf_ssb_append_post(ssb, args.message); tf_ssb_destroy(ssb); @@ -575,7 +577,7 @@ static int _tf_command_check(const char* file, int argc, char* argv[]) bool result = true; sqlite3* db = NULL; - sqlite3_open("db.sqlite", &db); + sqlite3_open(k_db_path_default, &db); if (extra_count) { for (int i = 0; i < extra_count; i++) @@ -630,7 +632,7 @@ static int _tf_command_private(const char* file, int argc, char* argv[]) bool result = true; sqlite3* db = NULL; - sqlite3_open("db.sqlite", &db); + sqlite3_open(k_db_path_default, &db); tf_ssb_db_private(db); sqlite3_close(db); if (extras)