Last active
August 12, 2020 10:22
-
-
Save surajtruckx/7b977c192510b95eb2a495c185adc8f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you please let me know, which variable is this ->
this.sqlInstance
?