question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cordova driver using unsupported sql transaction statements

See original GitHub issue

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: 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

@brodybits

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
insel-mazcommented, Oct 4, 2021

We also had to set transaction to false in SaveOptions or RemoveOptions to use Repository.save() or Repository.remove().

0reactions
jacobgcommented, Jun 21, 2021

@imnotjames Ah, so setting migrationsTransactionMode: 'none' keep everything working. Ok, sounds good. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

cordova-sqlite-storage - npm Package Health Analysis - Snyk
Native interface to SQLite for PhoneGap / Cordova - cordova-sqlite-storage plugin version For more information about how to use this package see README....
Read more >
SQLTransaction - Apache Cordova
SQLTransaction. Contains methods that allow the user to execute SQL statements against the Database. Methods. executeSql: executes a SQL statement. Details.
Read more >
Error while executing transactions in Ionic 2 app using Sqlite ...
I'm currently running the code on Android 6.0 based device. I've read the following documentation of sql transactions in Cordova sqlite plugin ...
Read more >
15.7.2.1 Transaction Isolation Levels - MySQL :: Developer Zone
For locking reads ( SELECT with FOR UPDATE or FOR SHARE ), UPDATE statements, and DELETE statements, InnoDB locks only index records, not...
Read more >
Database Engine events and errors - SQL Server
563, 14, No, The transaction for the INSERT EXEC statement has been ... Use the current activity window in SQL Server Management Studio...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found