Hi all,
I use SQLite for store some informations and use them. Then i declare an SQLiteObject as class value, i create my database if not exist and i insert my value into my table. I execute my query with the executeSQL method of my SQLiteObject but ionic say " method undefined and don’t know why.
There is a part of my code :
import { SQLite, SQLiteObject } from '@ionic-native/sqlite';
@IonicPage({ name: "main", segment: "app"} )
@Component({
selector: 'page-accueil',
templateUrl: 'accueil.html',
})
export class AccueilPage {
historique: any[];
private valHistorique: string[] = [];
private db: SQLiteObject;
constructor(private sqlite: SQLite) {}
private initHistorique()
{
// Create database if not exist
console.log(this.db);
this.sqlite.create({
name: 'data.db',
location: 'default'
})
.then((db: SQLiteObject) => {
console.log("db created !");
this.db = db;
this.db.executeSql('CREATE TABLE IF NOT EXISTS `HISTORIQUE_ACCUEIL` (`idAnnonces` INTEGER NOT NULL)', {})
.then(() => console.log('Table historique created'))
.catch(e => console.log(e));
})
.catch(e => console.log(e));
}
[...]
Any ideas ?