Skip to content

Commit

Permalink
Add debug output to determine DB access threadsafe value
Browse files Browse the repository at this point in the history
* Add debug output to determine DB access threadsafe value
  • Loading branch information
abraunegg committed Oct 24, 2023
1 parent b9f20cd commit b3a1e4a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/itemdb.d
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ final class ItemDatabase {
db.exec("DROP TABLE item");
createTable();
}

// What is the threadsafe value
auto threadsafeValue = db.getThreadsafeValue();
log.vdebug("Threadsafe database value: ", threadsafeValue);

// Set the enforcement of foreign key constraints.
// https://www.sqlite.org/pragma.html#pragma_foreign_keys
// PRAGMA foreign_keys = boolean;
Expand Down
6 changes: 6 additions & 0 deletions src/sqlite.d
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ struct Database {
}
return userVersion;
}

int getThreadsafeValue() {
// Get the threadsafe value
auto threadsafeValue = sqlite3_threadsafe();
return threadsafeValue;
}

string getErrorMessage() {
return ifromStringz(sqlite3_errmsg(pDb));
Expand Down

0 comments on commit b3a1e4a

Please sign in to comment.