Fix exporting.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4177 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
6b5d73ed5c
commit
507a62539d
@ -47,7 +47,7 @@ tfrpc.register(async function closeConnection(id) {
|
|||||||
});
|
});
|
||||||
tfrpc.register(async function query(sql, args) {
|
tfrpc.register(async function query(sql, args) {
|
||||||
let result = [];
|
let result = [];
|
||||||
await ssb.sqlStream(sql, args, function callback(row) {
|
await ssb.sqlAsync(sql, args, function callback(row) {
|
||||||
result.push(row);
|
result.push(row);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
14
src/main.c
14
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)." },
|
{ "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;
|
struct backtrace_state* g_backtrace_state;
|
||||||
|
|
||||||
void shedPrivileges()
|
void shedPrivileges()
|
||||||
@ -192,7 +194,7 @@ static int _tf_command_import(const char* file, int argc, char* argv[])
|
|||||||
XOPT_NULLOPTION,
|
XOPT_NULLOPTION,
|
||||||
};
|
};
|
||||||
|
|
||||||
args_t args = { .user = "import" };
|
args_t args = { .user = "import", .db_path = k_db_path_default };
|
||||||
const char** extras = NULL;
|
const char** extras = NULL;
|
||||||
int extra_count = 0;
|
int extra_count = 0;
|
||||||
const char *err = NULL;
|
const char *err = NULL;
|
||||||
@ -253,7 +255,7 @@ static int _tf_command_export(const char* file, int argc, char* argv[])
|
|||||||
XOPT_NULLOPTION,
|
XOPT_NULLOPTION,
|
||||||
};
|
};
|
||||||
|
|
||||||
args_t args = { .user = "core" };
|
args_t args = { .user = "core", .db_path = k_db_path_default };
|
||||||
const char** extras = NULL;
|
const char** extras = NULL;
|
||||||
int extra_count = 0;
|
int extra_count = 0;
|
||||||
const char *err = NULL;
|
const char *err = NULL;
|
||||||
@ -389,7 +391,7 @@ static int _tf_command_run(const char* file, int argc, char* argv[])
|
|||||||
.http_port = 12345,
|
.http_port = 12345,
|
||||||
.https_port = 12346,
|
.https_port = 12346,
|
||||||
.ssb_port = 8009,
|
.ssb_port = 8009,
|
||||||
.db_path = "db.sqlite",
|
.db_path = k_db_path_default,
|
||||||
};
|
};
|
||||||
const char** extras = NULL;
|
const char** extras = NULL;
|
||||||
int extra_count = 0;
|
int extra_count = 0;
|
||||||
@ -533,7 +535,7 @@ static int _tf_command_post(const char* file, int argc, char* argv[])
|
|||||||
return 2;
|
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_broadcast_listener_start(ssb, false);
|
||||||
tf_ssb_append_post(ssb, args.message);
|
tf_ssb_append_post(ssb, args.message);
|
||||||
tf_ssb_destroy(ssb);
|
tf_ssb_destroy(ssb);
|
||||||
@ -575,7 +577,7 @@ static int _tf_command_check(const char* file, int argc, char* argv[])
|
|||||||
|
|
||||||
bool result = true;
|
bool result = true;
|
||||||
sqlite3* db = NULL;
|
sqlite3* db = NULL;
|
||||||
sqlite3_open("db.sqlite", &db);
|
sqlite3_open(k_db_path_default, &db);
|
||||||
if (extra_count)
|
if (extra_count)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < extra_count; i++)
|
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;
|
bool result = true;
|
||||||
sqlite3* db = NULL;
|
sqlite3* db = NULL;
|
||||||
sqlite3_open("db.sqlite", &db);
|
sqlite3_open(k_db_path_default, &db);
|
||||||
tf_ssb_db_private(db);
|
tf_ssb_db_private(db);
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
if (extras)
|
if (extras)
|
||||||
|
Loading…
Reference in New Issue
Block a user