I have installed cordova-sqlite-storage
$ ionic plugin list
cordova-plugin-console 1.0.3 "Console"
cordova-plugin-device 1.1.2 "Device"
cordova-plugin-device-orientation 1.0.3 "Device Orientation"
cordova-plugin-fullscreen 1.1.0 "cordova-plugin-fullscreen"
cordova-plugin-inappbrowser 1.4.0 "InAppBrowser"
cordova-plugin-splashscreen 3.2.2 "Splashscreen"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
cordova-sqlite-storage 1.4.6 "Cordova sqlite storage plugin" ***
ionic-plugin-keyboard 2.2.0 "Keyboard"
I have a simple wrapper of Storage
import {Storage, SqlStorage} from 'ionic-angular';
export class DBService extends Storage {
constructor() {
super(SqlStorage, {
// Database name
name: 'mydb',
// Use iCloud when availabel
backupFlag: SqlStorage.BACKUP_LIBRARY,
// Load existing database if available
existingDatabase: true
});
}
}
Neither on desktop chrome with ionic server, nor on android simulator with ionic emulate android
, this.db.set(cacheKey, string)
isn’t working, there is no error.
According to http://ionicframework.com/docs/v2/api/platform/storage/SqlStorage/
For convenience, the engine supports key/value storage for simple get/set and blob storage. The full SQL engine is exposed underneath through the query method. Using
ths.db.get(cacheKey)
always returnedundefined
.
I’m supposed to be able to use set()/get()
even with SqlStorage but it’s not working. Why?