forked from cory/tildefriends
getIdentityInfo => C.
This commit is contained in:
19
src/ssb.db.c
19
src/ssb.db.c
@ -1735,3 +1735,22 @@ bool tf_ssb_db_set_property(tf_ssb_t* ssb, const char* id, const char* key, cons
|
||||
tf_ssb_release_db_writer(ssb, db);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool tf_ssb_db_identity_get_active(sqlite3* db, const char* user, const char* package_owner, const char* package_name, char* out_identity, size_t out_identity_size)
|
||||
{
|
||||
sqlite3_stmt* statement = NULL;
|
||||
bool found = false;
|
||||
if (sqlite3_prepare(db, "SELECT value FROM properties WHERE id = ? AND key = 'id:' || ? || ':' || ?", -1, &statement, NULL) == SQLITE_OK)
|
||||
{
|
||||
if (sqlite3_bind_text(statement, 1, user, -1, NULL) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 2, package_owner, -1, NULL) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 3, package_name, -1, NULL) == SQLITE_OK &&
|
||||
sqlite3_step(statement) == SQLITE_ROW)
|
||||
{
|
||||
snprintf(out_identity, out_identity_size, "%s", (const char*)sqlite3_column_text(statement, 0));
|
||||
found = true;
|
||||
}
|
||||
sqlite3_finalize(statement);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
Reference in New Issue
Block a user