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

How to use named params? #717

Open
DanielSWolf opened this issue Sep 7, 2017 · 7 comments
Open

How to use named params? #717

DanielSWolf opened this issue Sep 7, 2017 · 7 comments

Comments

@DanielSWolf
Copy link

The second parameter of executeSql contains values to be passed to SQLite as bind parameters. According to the SQLite documentation, such parameters can be positional or named. So I was expecting the following to work:

executeSql(
  'select * from Assignment where id = :assignmentId',
  { assignmentId: 42 },
  success, error);

However, this doesn't seem to work. How can I use named params with the Cordova SQLite storage plugin?

@brodycj
Copy link
Contributor

brodycj commented Oct 30, 2017

https://sqlite.org/lang_expr.html#varparam

Named parameters are not part of the Web SQL DRAFT API and also not supported by this plugin.

It would be a nice feature to support. I do not expect to support this in the near future. For future consideration.

@brodycj
Copy link
Contributor

brodycj commented Jan 12, 2018

This idea is marked as a possible enhancement for discussion. I would consider this to be a major change, especially in the evcore/evplus versions, and it would not be easy to support on the browser platform, which is part of the plan for the next major release in #687. (Clumsy alternative would be to use https://github.com/kripken/sql.js/ to support browser platform, for testing purposes. Not recommended and not guaranteed to work.)

In case you really want this change I would like to do this as part of a possible redesign, possibly based on the evcore implementation and probably with a much simpler JavaScript API (maybe similar to node-sqlite3, Promise-based API should be no problem). I would be happy to send you an estimate within the next few days in case you are interested.

@brodycj
Copy link
Contributor

brodycj commented Jan 15, 2018

P.S. If desired I would probably implement this change as part of a possible redesign discussed in #548.

@brodycj
Copy link
Contributor

brodycj commented Sep 13, 2019

This feature is now part of the discussion of an improved API with a redesigned implementation in #862.

@shadoWalker89
Copy link

+1 For this feature

@brodycj
Copy link
Contributor

brodycj commented Sep 2, 2021

As discussed in brodycj/ask-me-anything#3, I have started a redesign and recently pushed some updates to support the named parameters on Android, iOS, and macOS. Integration with the features in this plugin and on other platforms such as Windows is now for future consideration.

@huiitre
Copy link

huiitre commented May 24, 2024

Hello, is this feature now available for Android now ?

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

4 participants