RC0 migration question
@jgw96 did you guys get rid of SqlStorage ?. In beta 11 i used to do:
import { SqlStorage, Storage } from 'ionic-angular';
...
storage = new Storage(SqlStorage);
But after rc0 upgrade am getting following error:
/node_modules/ionic-angular/index"' has no exported member 'SqlStorage'.
Please check the changelog: https://github.com/driftyco/ionic/blob/master/CHANGELOG.md#200-rc0-2016-09-28
It is mentioned under Storage: https://github.com/driftyco/ionic/blob/master/CHANGELOG.md#storage
Thanks!
@brandyscarney can you pleas point me where it says anything about SqlStorage or copy text here ? Thanks a lot
@brandyscarney i search changelog page for sqlstorage and did not find any info.
Ah, valid question! I'll reopen this to look into documentation, but here is the source for Storage: https://github.com/driftyco/ionic-storage/blob/master/src/storage.ts#L14-L27
this is now 404: http://ionicframework.com/docs/v2/api/platform/storage/Storage/
Yeah I talked to the team and we are going to work on getting the docs generated for Storage. I created an issue on our site repo to make sure this gets added: https://github.com/driftyco/ionic-site/issues/800
Going to close this and work to get it added will be there!
Hi. it's good but how to make queries? So now we have only key/value implementation
Same question. How we can perform query on local DB?
For example In beta11 I wrote:
import {Storage, SqlStorage} from 'ionic-angular'; ... this.storage = new Storage(SqlStorage); this.storage('CREATE TABLE mytable (field1 TEXT,field2 TEXT,field3 TEXT)'); this.storage('SELECT * FROM mytable'); ... this.storage('INSERT INTO mytable ('field1','field2','field3') VALUES ('v1','v2','v3')'); ...
+1
+1
+1
this.store = new Storage(SqlStorage, {name: "Db"});
this.store.query("CREATE TABLE IF NOT EXISTS lista (id INT PRIMARY KEY NOT NULL, record TEXT)")
This works for me, but only on serve --lab, on emulator or device Database seems to fail...
Hey all, we don't support this in the new storage engine, and here's my response on why that's the case: https://github.com/driftyco/ionic/issues/8269#issuecomment-250590367
tl;dr: if you want to use a SQL database, just use SQLite directly, from ionic-native or another plugin. WebSQL is deprecated so usage of that is shaky. Additionally, using SQLite directly gives you full access to the engine and all the features, without going through a layer like SqlStorage that may or may not expose all those features. Sorry for not communicating that but we think this is the best way to move forward and there are some options in that issue on how to get the old service back (considering the code is still available in a github history somewhere!)
@mlynch The problem about the use of SQLite directly is that you can't test it on a browser (if I'm right), so you have to run app in device / emulator.