From c2eb439574619b33340264a17c7bac88e9d5ae33 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Wed, 7 Dec 2022 23:24:31 +0000 Subject: [PATCH] Fix messages_refs. Oops. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4071 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.db.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ssb.db.c b/src/ssb.db.c index 6ab7c4ab..5cb07c95 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -144,7 +144,7 @@ void tf_ssb_db_init(tf_ssb_t* ssb) ")"); printf("Populating messages_refs...\n"); _tf_ssb_db_exec(db, "INSERT INTO messages_refs(message, ref) " - "SELECT messages.id, j.value FROM messages, json_each(messages.content) as j WHERE " + "SELECT messages.id, j.value FROM messages, json_tree(messages.content) as j WHERE " "j.value LIKE '&%.sha256' OR " "j.value LIKE '%%%.sha256' OR " "j.value LIKE '@%.ed25519' " @@ -155,7 +155,7 @@ void tf_ssb_db_init(tf_ssb_t* ssb) _tf_ssb_db_exec(db, "DROP TRIGGER IF EXISTS messages_ai_refs"); _tf_ssb_db_exec(db, "CREATE TRIGGER IF NOT EXISTS messages_ai_refs AFTER INSERT ON messages BEGIN " "INSERT INTO messages_refs(message, ref) " - "SELECT DISTINCT new.id, j.value FROM json_each(new.content) as j WHERE " + "SELECT DISTINCT new.id, j.value FROM json_tree(new.content) as j WHERE " "j.value LIKE '&%.sha256' OR " "j.value LIKE '%%%.sha256' OR " "j.value LIKE '@%.ed25519' " @@ -644,6 +644,7 @@ static int _tf_ssb_sqlite_authorizer(void* user_data, int action_code, const cha result = ( strcmp(arg0, "blob_wants") == 0 || strcmp(arg0, "json_each") == 0 || + strcmp(arg0, "json_tree") == 0 || strcmp(arg0, "messages") == 0 || strcmp(arg0, "messages_fts") == 0 || strcmp(arg0, "messages_fts_idx") == 0 ||