ssb: Add a has_blob command. #89
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 29m14s

This commit is contained in:
2025-01-06 20:46:16 -05:00
parent 7f87714b58
commit d0bbd7f24f
4 changed files with 66 additions and 6 deletions

View File

@ -603,11 +603,10 @@ bool tf_ssb_db_message_content_get(tf_ssb_t* ssb, const char* id, uint8_t** out_
return result;
}
bool tf_ssb_db_blob_has(tf_ssb_t* ssb, const char* id)
bool tf_ssb_db_blob_has(sqlite3* db, const char* id)
{
bool result = false;
sqlite3_stmt* statement;
sqlite3* db = tf_ssb_acquire_db_reader(ssb);
const char* query = "SELECT COUNT(*) FROM blobs WHERE id = ?1";
if (sqlite3_prepare(db, query, -1, &statement, NULL) == SQLITE_OK)
{
@ -617,7 +616,6 @@ bool tf_ssb_db_blob_has(tf_ssb_t* ssb, const char* id)
}
sqlite3_finalize(statement);
}
tf_ssb_release_db_reader(ssb, db);
return result;
}