android - using sqlite in nativescript application: DB not persistent -
i'm trying use nativescript-sqlite plugin described . on project page https://github.com/nathanaela/nativescript-sqlite .
to maintain reasonable project struture, wand put sqlite related stuff in service.
@injectable() export class itemservice { private items = new array<item>(); private database: any; public constructor() { (new sqlite("my.db")).then(db => { db.execsql("create table if not exists people (id integer primary key autoincrement, firstname text, lastname text, role text)").then(id => { this.database = db; }, error => { console.log("create table error", error); }); }, error => { console.log("open db error", error); }); } .... while application runs, it's working expected, unfortunately data not persist. app closed , restartet, db seems empty/recreated.
do have hint me what's missing? or have more extensive example app source code @ hand?
thanks lot
Comments
Post a Comment