Add note about transaction handling

This commit is contained in:
Jeremy Ruston 2024-02-25 09:48:24 +00:00
parent 1c0341de51
commit 630b98520f
1 changed files with 2 additions and 0 deletions

View File

@ -501,6 +501,8 @@ SqlTiddlerDatabase.prototype.getRecipeBags = function(recipename) {
Execute the given function in a transaction, committing if successful but rolling back if an error occurs. Returns whatever the given function returns.
Calls to this function can be safely nested, but only the topmost call will actually take place in a transaction.
TODO: better-sqlite3 provides its own transaction method which we should be using if available
*/
SqlTiddlerDatabase.prototype.transaction = function(fn) {
const alreadyInTransaction = this.transactionDepth > 0;