Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for using other db within a transaction
This commit makes it easy to have multiple Dexie instances and be able to use one within the transaction scope of the other without having to work around this with Dexie.spawn() or transaction scopes marked with "!". The simple scenario is like this: // Application database var db = new Dexie("app-database"); // Log database var logDb = new Dexie("log"); You want to be able to use logDb within transactions of db. But in previous version this was only possible if surrounding calls to logDb in a transaction marked as "!", or by using Dexie.spawn(). In previous version, you would have to encapsulate all calls to logDb like this: // Code needed before: function log(message) { logDb.transaction('rw!', logDb.log, function () { logDb.log.add(logEntry); }); } After this commit, this is no longer needed since it could be told by the ongoing transaction whether it belongs to the same db or not: // Now you don't need to care: function log(message) { logDb.log.add(logEntry); } Also: Corrected some lazy coded unit tests that utilized its own Dexie instances (testDB etc) but lazily used just 'db' where testDB was intended to use. These tests didnt fail before but started to fail now. Removed a unit test that should verify that mixing database instances should not be possible within a transaction. Needed to remove the test because that is possible now.
- Loading branch information
1 parent
04568ee
commit 8d9c062
Showing
3 changed files
with
44 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters