ssb: Chasing intermittent SQLITE_ERROR with multiple processes accessing the database. Switching to sqlite3_prepare_v2 for better errors, but maybe this is also the solution?

This commit is contained in:
2025-05-21 22:05:33 -04:00
parent 61ae9ae465
commit 92926fa8df
9 changed files with 87 additions and 79 deletions

View File

@ -94,7 +94,7 @@ void tf_ssb_export(tf_ssb_t* ssb, const char* key)
sqlite3* db = tf_ssb_acquire_db_reader(ssb);
sqlite3_busy_timeout(db, 10000);
sqlite3_stmt* statement;
if (sqlite3_prepare(db, "SELECT value FROM properties WHERE id = ?1 AND key = 'path:' || ?2", -1, &statement, NULL) == SQLITE_OK)
if (sqlite3_prepare_v2(db, "SELECT value FROM properties WHERE id = ?1 AND key = 'path:' || ?2", -1, &statement, NULL) == SQLITE_OK)
{
if (sqlite3_bind_text(statement, 1, user, -1, NULL) == SQLITE_OK && sqlite3_bind_text(statement, 2, path, -1, NULL) == SQLITE_OK && sqlite3_step(statement) == SQLITE_ROW)
{