Reputation: 59
Cordova-Docu says:
WebSQL Not supported by all Cordova platforms. More complex to work with than LocalStorage or IndexedDB. The API is deprecated. It is unlikely to ever be supported on platforms that don't currently support it, and it may be removed from platforms that do. Imposes a rigid structure that must be defined up-front. Limited total amount of storage (typically around 5MB).
Id like to deploy an Angular2-Cordova-App with a SQL-like App on client-side. Can anyone recomend an alternative? Thanks a lot!
Upvotes: 1
Views: 2213
Reputation: 6511
You could use SQLite with a plugin like this.
Just quoting from the readme:
This plugin provides a WebSQL-compatible API to store data in a Cordova/PhoneGap/Ionic app, by using a SQLite database on the native side. The main benefits are:
- unlimited and durable storage
- prepopulated databases
- support where WebSQL isn't available (namely iOS WKWebView)
Depending on your needs you could also use something like LocalForage.
Upvotes: 5
Reputation: 5799
The below repo might help you. You can use it to use websql but actually without using sql.
https://github.com/paulocaldeira17/angular-websql
Example for inserting:
$scope.db.insert('user', {"username": 'pc', "password": '1234', 'age': 22}).then(function(results) {
console.log(results.insertId);
})
Upvotes: 1