To get started, we recommend you create two javascript files, one is DemoDataContext.js that defines your database and entities, and the other is DemoDbService.js that accesses to your database and contains the business logic.

Then, in your index.html, call new DemoDbService().init(callback) ; This method is expected to check database schema version, and init intial data. When you have your database schema changed, you just need to change the constructor call of your DemoDataContext. For example:

nova.data.DbContext.call(this, "Demo", "1.1", "Demo DB", 1000000);
    

Also you may need to override the initData of nova.data.DbContext. For example:

//note: below code must be after the line of DemoDataContext.constructor = DemoDataContext;
DemoDataContext.prototype.initData = function (callback) {
    //insert initial data to database.
    nova.data.DbContext.prototype.initData.call(this, callback);
};

Last edited Mar 19, 2013 at 2:41 PM by leo_2010, version 4

Comments

No comments yet.