Skip to content

Adapter for native SQLite via plugin on Cordova/Phonegap platform - #221

Open
dpa99c wants to merge 1 commit into
brianleroux:masterfrom
dpa99c:master
Open

Adapter for native SQLite via plugin on Cordova/Phonegap platform#221
dpa99c wants to merge 1 commit into
brianleroux:masterfrom
dpa99c:master

Conversation

@dpa99c

@dpa99c dpa99c commented Dec 17, 2015

Copy link
Copy Markdown

This adapter is specifically for Cordova/Phonegap.
Advantages are:

  • it allows lawnchair to store an unlimited amount of data in a native SQLite database via a plugin.
  • the DB can be pre-populated via a .db file, so bundled with an app release
  • persistence is guaranteed (e.g. local storage of a Cordova app may get nuked by iOS if device storage is low)

I realise it doesn't quite fit with other adapters; particularly when it comes to testing, the existing qunit tests will not work with it as it must be executed in a Cordova environment. I've created a Cordova project which adapts the qunit tests to run in the Cordova environment with this adapter and the others. This could be potentially combined with your existing repo if you wanted.

Understand if it's a bit out of scope and you want to bounce the pull request :-)

@MarkMYoung

Copy link
Copy Markdown
Collaborator

Wow, this looks really good, Dave. I haven't packaged to PhoneGap in about a year so I'd like for someone else to download this and provide their experiences before merging it.

@dpa99c

dpa99c commented Dec 18, 2015

Copy link
Copy Markdown
Author

Sure thing, a peer review is a good idea. I'm particularly not sure how best to merge the cordova spec project with your existing repo.

@MarkMYoung

Copy link
Copy Markdown
Collaborator

Could you elaborate how your adapter might not merge well? Sometimes the core must be modified to accommodate a more complex feature.

I read your modifications. Other than a couple unnecessary whitespace changes, everything looks fine to me. For the benefit of whoever reviews your plugin, what's your concern?

@dpa99c

dpa99c commented Dec 18, 2015

Copy link
Copy Markdown
Author

While the adapter is functionally very similar to the WebSQL adapter, it's the spec that's a bit tricky. While the other adapters can easily be tested in a desktop browser, hence the qunit tests being run as part of the Make build, this adapter can only be tested from within a Cordova app running on a mobile platform where a native SQLite DB can be made available. Therefore testing this adapter is a manual process that can't be easily automated like for the other adapters. But if you live with that then I can integrate my Cordova test project with the lawnchair repo and update the Make script to deploy the lawnchair and qunit assets to it. That was all :-)

@MarkMYoung

Copy link
Copy Markdown
Collaborator

Does the Cordova SQLite implementation require a row's primary key be 'id'? It doesn't allow for a different row key or for compound keys? If it does, the adapter needs to use the methods that hook into the 'keyPath' plugin so users can customize table columns and constraints.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants