Awesome
Cordova sqlite lawnchair adapter
Extracted from work in the following projects:
LICENSE: MIT
STATUS: Community maintained
Common adapter
Please look at the Lawnchair-adapter
tree that contains a common adapter, which should also work with the Android version, along with a test-www directory.
Included files
Include the following Javascript files in your HTML:
cordova.js
(don't forget!)lawnchair.js
(you provide)SQLitePlugin.js
(in case of Cordova pre-3.0)Lawnchair-sqlitePlugin.js
(must come afterSQLitePlugin.js
in case of Cordova pre-3.0)
Lawnchair Sample
The name
option determines the sqlite database filename, with no extension automatically added. Optionally, you can change the db filename using the db
option.
In this example, you would be using/creating a database with filename kvstore
:
kvstore = new Lawnchair({name: "kvstore"}, function() {
// do stuff
);
Using the db
option you can specify the filename with the desired extension and be able to create multiple stores in the same database file. (There will be one table per store.)
recipes = new Lawnchair({db: "cookbook", name: "recipes", ...}, myCallback());
ingredients = new Lawnchair({db: "cookbook", name: "ingredients", ...}, myCallback());
KNOWN ISSUE: Not all db options are supported by the Lawnchair adapter. The workaround is to first open the database file using sqlitePlugin.openDatabase()
.