cordova driver using unsupported sql transaction statements
See original GitHub issueIssue type:
[ ] question [X ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[X ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[X ] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
The cordova driver’s CordovaQueryRunner, which extends AbstractSqliteQueryRunner, uses sql statements to begin, commit and rollback transactions. But the cordova sqlite plugin documents that such transactions are unsupported:
User-defined savepoints are not supported and not expected to be compatible with the transaction locking mechanism used by this plugin. In addition, the use of BEGIN/COMMIT/ROLLBACK statements is not supported. https://github.com/xpbrew/cordova-sqlite-storage#other-limitations
Rather the plugin documents that the WebSql db.transaction() api should be used. Notably, it may be difficult, if even possible, to use the db.transaction() api in the cordova driver, as the driver semantics rely on asynchronous and undefined transaction boundaries, whereas the transaction api is limited to more synchronous boundaries sort of like a message queue that automatically closes when it’s empty. Also there is no support for explicit rollback in the websql api.
I’ve opened an issue in the plugin’s repo to more explicitly document the behavior of transaction statements, particularly if used serially. If they do work serially, then perhaps this driver could enforce that, or the plugin should: https://github.com/xpbrew/cordova-sqlite-storage/issues/863
I’ve also opened issues in the plugin repo to create a new api to allow for better transaction support and concurrency: https://github.com/xpbrew/cordova-sqlite-storage/issues/862 https://github.com/xpbrew/cordova-sqlite-storage/issues/864
Related issue here: #1884
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:10 (8 by maintainers)
Top GitHub Comments
We also had to set
transaction
to false inSaveOptions
orRemoveOptions
to useRepository.save()
orRepository.remove()
.@imnotjames Ah, so setting
migrationsTransactionMode: 'none'
keep everything working. Ok, sounds good. Thanks!