Hello,
I actually try to make an mobile app with SQLite. I juste try to create two tables:
constructor(private sqlite:SQLite,public modalCtrl: ModalController,public navCtrl: NavController, private navParam: NavParams, private databaseprovider: DatabaseProvider, private employeesProvider: EmployeeProvider) {
this.createDetabaseFile();
}
private createDetabaseFile() : void {
this.sqlite.create({
name: DATABASE_FILE_NAME,
location: 'default'
}).then((dbRes: SQLiteObject) => {
alert("bdd créée");
this.db = dbRes;
this.createTables();
})
}
private createTables() : void {
this.db.executeSql('CREATE table IF NOT EXISTS symbole(id INTEGER NOT NULL ,name TEXT)',{})
.then(() => {
alert("table symbole created");
this.db.executeSql('CREATE table IF NOT EXISTS representationPhoto(name VARCHAR(32))',{})
.then(() => {
alert("table representationPhoto created");
})
.catch(e => alert("erreur creation table"));
})
.catch(e => alert("erreur creation table"));
}
And db.executeSql() seem not working, indeed, the alert(“table symbole created”); don’t appear, however alert(“bdd créée”) appear, and the program don’t triggered the catch.
Have you an idea?
ps: sorry for my bad english