Skip to content

cordova driver using unsupported sql transaction statements #4075

@jacobg

Description

@jacobg

Issue 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:
storesafe/cordova-sqlite-storage#863

I've also opened issues in the plugin repo to create a new api to allow for better transaction support and concurrency:
storesafe/cordova-sqlite-storage#862
storesafe/cordova-sqlite-storage#864

Related issue here: #1884

@brodybits

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions