Skip to content

Instantly share code, notes, and snippets.

@surajtruckx
Last active August 12, 2020 10:22
Show Gist options
  • Save surajtruckx/7b977c192510b95eb2a495c185adc8f9 to your computer and use it in GitHub Desktop.
Save surajtruckx/7b977c192510b95eb2a495c185adc8f9 to your computer and use it in GitHub Desktop.
import { IonicPage } from 'ionic-angular';
import { SqlProvider } from '../path/to/sql-provider';
@IonicPage()
@Component({
selector: 'page-home',
templateUrl: 'home.html',
})
export class HomePage {
constructor(private sql:SqlProvider) {
}
async ionViewDidLoad () {
await this.sql.dbInstance.executeSql('CREATE TABLE IF NOT EXISTS user(id INTEGER PRIMARY KEY, name)');
await this.sql.dbInstance.executeSql(`INSERT INTO user(id, user) VALUES (1, 'Suraj')`);
let users = await this.sqlInstance.executeSql('SELECT * FROM user');
console.log(users);
}
}
@mitesh-shah
Copy link

Could you please let me know, which variable is this -> this.sqlInstance ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment