Sqlstorage alternative to debug from browser


#1

Hi guys I´m so dissapointed with last update (rc0)… I have an app where I used sqlstorage to persistence data and now it doesn´t work. I googled a lot and I have tested with SQLite Native ionic pluging and I noticed that it only works from physical devices , it doesn´t work from browser. That is a problem and a lack of time when your are debuging.

I could be confused and there is another way to have persistence data for all (devices and browser).

I hope anyone could help me.
Thanks a lot


#2

I know is later but here is my answer to my question :grinning:
We can define different storage depends we are with cordova or with browser.

init(): Promise<any> {
		console.log("Init DatabaseProvider, a cotinuación tipo de dispositivo.");
		return new Promise((resolve) => {
			if (typeof window.sqlitePlugin !== 'undefined') {
				this.db = window.sqlitePlugin.openDatabase({ name: this.dbname, location: 'default' });
				 //console.log("--> running on device: ", this.db);
			} else {
				this.db = window.openDatabase(this.dbname, '1.0', 'Test DB', -1);
				 //console.log("--> running in browser: ", this.db);
			};
		});
	}

I hope it helps someone!

Thanks guys


#3

If u r using this to store ovjects only then I believe ionic storage has ways to define the order of drivers to use, pending preference and availability

So your pattern would not be needed, I would say

But again, all depends on your use case