Short description of the problem:
Currently , it is not possible to get transaction directly from Storage with Ionic 2. The only way, is to make a request and get a transaction in return.
private storage = new Storage(SqlStorage, { name: 'myDatabase, location: 'default' });
this.storage.query("SELECT 'one request for transaction'")
.then((response) => {
response.tx.executeSql("CREATE TABLE IF NOT EXISTS USER (id integer primary key, name text");
response.tx.executeSql("CREATE TABLE IF NOT EXISTS PROJECT (id integer primary key, name text");
});
What behavior are you expecting?
Get transaction directly from SqlStorage
this.storage.transaction(function (transaction) {
transaction.executeSql("CREATE TABLE IF NOT EXISTS USER (id integer primary key, name text");
transaction.executeSql("CREATE TABLE IF NOT EXISTS PROJECT (id integer primary key, name text");
});
Ionic 2.x