-
Notifications
You must be signed in to change notification settings - Fork 716
Description
The deprecated Web SQL transaction API described in https://www.w3.org/TR/webdatabase/ has led to some bugs and significant confusion over the past few years. For example:
- TypeError in success callback #409 - TypeError in success callback, fixed with a workaround solution
- plugin would fire more callbacks after an error with no error handler that returns
false(fixed with no issue filed) - Transaction problem after page change, WITH POSSIBLE DATA LOSS #666 - Transaction problem after page change, WITH POSSIBLE DATA LOSS (fixed with a workaround solution in this plugin version)
- Simultaneously Transactions with web workers and main app litehelpers/cordova-sqlite-evmax-ext-workers-legacy-build-free#3 - transaction within a transaction issue with simultaneous transactions in web worker and main app code in that version (workaround is to use
database.executeSqlanddatabase.sqlBatchinstead ofdatabase.transactionin both worker and main app code)
ADDITIONAL ISSUES DISCOVERED:
- not possible to support Web SQL transaction API in worker on the Browser platform ref: New premium version with web worker support upon customer demand (under consideration) cordova-sqlite-evcore-extbuild-free#11
- Problem with workaround solution to Transaction problem after page change, WITH POSSIBLE DATA LOSS #666 reported in Transaction problem after page change, WITH POSSIBLE DATA LOSS #666 (comment)
- Database might be busy when close is called ref: Database might be busy when close is called #702
Given these issues I would like to deprecate the db.transaction call in the next major release discussed in #687. Users would be advised to use db.executeSql for SELECT and single-statement changes and database.sqlBatch for multi-statement changes as already documented. These calls would be supported on the "browser" platform in addition to Android/iOS/macOS/Windows.
I am thinking of the following options:
- Require a special setting in sqlitePlugin.openDatabase if the user wants to use the standard
db.transactioncall - The
dbobject constructed by thesqlitePlugin.openDatabasecall would not support the standarddb.transactioncall. Instead the user could issue a call such asdb.getStandardDatabaseHandle()to get a new object that does support thedb.transactioncall.
I would like to leave this issue open for feedback from the user community.
ADDITIONAL NOTE: This may go along with be related to the possible redesign discussed in #548.