Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate standard transaction mechanism in next major release? #690

Closed
brodycj opened this issue May 11, 2017 · 8 comments
Closed

Deprecate standard transaction mechanism in next major release? #690

brodycj opened this issue May 11, 2017 · 8 comments

Comments

@brodycj
Copy link
Contributor

brodycj commented May 11, 2017

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:

ADDITIONAL ISSUES DISCOVERED:

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.transaction call
  • The db object constructed by the sqlitePlugin.openDatabase call would not support the standard db.transaction call. Instead the user could issue a call such as db.getStandardDatabaseHandle() to get a new object that does support the db.transaction call.

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.

@abram456
Copy link

abram456 commented Jun 5, 2017

Require a special setting in sqlitePlugin.openDatabase if the user wants to use the standard db.transaction call!!!! What is that special setting @brodybits ??

@brodycj
Copy link
Contributor Author

brodycj commented Jun 22, 2017

What is that special setting @brodybits ??

Not decided yet.

@kanoshin
Copy link

kanoshin commented Jun 22, 2017

In some cases it is useful to do several actions in one transaction that depend on each other. E.g. read some rows, perform calculation and then update this rows in the same transaction. Looks like new API doesn't allow it.

@mirko77
Copy link

mirko77 commented Aug 16, 2017

I am using db.transaction a lot to be fair, how are we handling backwards compatibility? By using that flag you mentioned? @brodybits

@RhinoLance
Copy link

As Chrome doesn't appear to support db.executeSql, this change will remove the ability to develop and test against a browser before moving to a device. That was always the strength of the plugin, in that I could transparently fall back to WebSQL if required.
The issues does state "These calls would be supported on the "browser" platform...", but it doesn't work for me. Am I missing something?

@brodycj
Copy link
Contributor Author

brodycj commented Feb 16, 2018

Thanks guys for the feedback, will not be removed from this plugin version.

@brodycj brodycj closed this as completed Feb 16, 2018
@iamjoyce
Copy link

iamjoyce commented Feb 20, 2018

@brodybits Does that mean that db.transaction may still be removed in future versions? In that case, is it recommended to just use executeSql where possible instead? Thanks

@brodycj
Copy link
Contributor Author

brodycj commented Mar 5, 2018

@brodybits Does that mean that db.transaction may still be removed in future versions?

Not from this plugin version. May not be supported by a new sqlite plugin based on possible redesign discussed in #548.

[...] is it recommended to just use executeSql where possible instead?

I would recommend db.executeSql() call for read and simple (single-statement) write or db.sqlBatch() call in case of multiple-statement modification. Simpler, more future-proof in case of new sqlite plugin version with redesign discussed in #548.

FYI a promise-based API wrapper is available in https://github.com/brodybits/sql-promise-helper, which provides functionality similar to db.executeSql() and db.sqlBatch() calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants