ssb: Make these queries match the index more pedandically, if only for consistency.
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
Some checks failed
Build Tilde Friends / Build-All (push) Has been cancelled
This commit is contained in:
parent
f0211f621e
commit
cf90533b6c
@ -1468,9 +1468,9 @@ static void _populate_follows_and_blocks(tf_ssb_t* ssb, following_t* entry, foll
|
|||||||
sqlite3* db = tf_ssb_acquire_db_reader(ssb);
|
sqlite3* db = tf_ssb_acquire_db_reader(ssb);
|
||||||
sqlite3_stmt* statement = NULL;
|
sqlite3_stmt* statement = NULL;
|
||||||
if (sqlite3_prepare(db,
|
if (sqlite3_prepare(db,
|
||||||
"SELECT json_extract(content, '$.contact') AS contact, json_extract(content, '$.following'), json_extract(content, '$.blocking') "
|
"SELECT content ->> '$.contact' AS contact, content ->> '$.following', content ->> '$.blocking' "
|
||||||
"FROM messages "
|
"FROM messages "
|
||||||
"WHERE contact IS NOT NULL AND author = ? AND json_extract(content, '$.type') = 'contact' "
|
"WHERE contact IS NOT NULL AND author = ? AND content ->> '$.type' = 'contact' "
|
||||||
"ORDER BY sequence",
|
"ORDER BY sequence",
|
||||||
-1, &statement, NULL) == SQLITE_OK)
|
-1, &statement, NULL) == SQLITE_OK)
|
||||||
{
|
{
|
||||||
@ -2306,7 +2306,7 @@ const char* tf_ssb_db_get_profile_name(sqlite3* db, const char* id)
|
|||||||
if (sqlite3_prepare(db,
|
if (sqlite3_prepare(db,
|
||||||
"SELECT name FROM (SELECT messages.author, RANK() OVER (PARTITION BY messages.author ORDER BY messages.sequence DESC) AS author_rank, "
|
"SELECT name FROM (SELECT messages.author, RANK() OVER (PARTITION BY messages.author ORDER BY messages.sequence DESC) AS author_rank, "
|
||||||
"messages.content ->> 'name' AS name FROM messages WHERE messages.author = ? "
|
"messages.content ->> 'name' AS name FROM messages WHERE messages.author = ? "
|
||||||
"AND json_extract(messages.content, '$.type') = 'about' AND content ->> 'about' = messages.author AND name IS NOT NULL) "
|
"AND messages.content ->> '$.type' = 'about' AND content ->> 'about' = messages.author AND name IS NOT NULL) "
|
||||||
"WHERE author_rank = 1",
|
"WHERE author_rank = 1",
|
||||||
-1, &statement, NULL) == SQLITE_OK)
|
-1, &statement, NULL) == SQLITE_OK)
|
||||||
{
|
{
|
||||||
@ -2472,7 +2472,7 @@ tf_ssb_identity_info_t* tf_ssb_db_get_identity_info(tf_ssb_t* ssb, const char* u
|
|||||||
" JOIN identities ON messages.author = ('@' || identities.public_key) "
|
" JOIN identities ON messages.author = ('@' || identities.public_key) "
|
||||||
" WHERE "
|
" WHERE "
|
||||||
" (identities.user = ? OR identities.public_key = ?) AND "
|
" (identities.user = ? OR identities.public_key = ?) AND "
|
||||||
" json_extract(messages.content, '$.type') = 'about' AND "
|
" messages.content ->> '$.type' = 'about' AND "
|
||||||
" content ->> 'about' = messages.author AND name IS NOT NULL) "
|
" content ->> 'about' = messages.author AND name IS NOT NULL) "
|
||||||
"WHERE author_rank = 1 ",
|
"WHERE author_rank = 1 ",
|
||||||
-1, &statement, NULL);
|
-1, &statement, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user