Note that there are some explanatory texts on larger screens.

plurals
  1. POI'm unable to use YDN-DB ("Version change transaction was aborted in upgradeneeded event handler.")
    text
    copied!<p>I'm having a problem to start with YDN-DB. I mean. I set up a scheme, I initialized the database, but when instantiating throws an error that says "ConstraintError: DOM Exception IDBDatabase 0". In the event handler "fail" gives me "Version change transaction was aborted in upgradeneeded event handler.". Reading about the problem I found with <a href="https://stackoverflow.com/a/17772759">this link</a>. Can not find the way to assign an event to trigger "onupgradeneeded" and I think that would solve the problem</p> <p>I leave my piece of code:</p> <pre><code>var shopgroups_schema = { name: 'shopgroups', keyPath: 'id_shop_group', autoIncrement: true, indexes: [ {keyPath: 'id_shop_group'}, {keyPath: 'name'}, {keyPath: 'share_customer'}, {keyPath: 'share_order'}, {keyPath: 'share_stock'}, {keyPath: 'active'}, {keyPath: 'deleted'}, {keyPath: 'date_add'}, {keyPath: 'date_upd'}, {keyPath: 'date_upd'} ] }; var shops_schema = { name: 'shops', keyPath: 'id_shop', autoIncrement: true, indexes: [ {keyPath: 'id_shop'}, {keyPath: 'id_shop_group'}, {keyPath: 'name'}, {keyPath: 'id_category'}, {keyPath: 'id_theme'}, {keyPath: 'active'}, {keyPath: 'deleted'}, {keyPath: 'date_add'}, {keyPath: 'date_upd'} ] }; var schema = { stores: [shopgroups_schema, shops_schema] }; var schemaName = 'chollingApp4'; var db = new ydn.db.Storage(schemaName, schema); db.addEventListener('error', function (event) { var e = event.getError(); // common errors are AbortError, ConstraintError and UnknownError (possibliy for Quota exceed error). // log error for debugging console.log('connection failed with ' + e.name); }); db.addEventListener('fail', function (event) { var err = event.getError(); console.log(event); console.log(err); console.log('connection failed with ' + err.name + ' by ' + err.message); db = null; // no operation can be placed to the database instance }); db.addEventListener('ready', function (event) { var is_updated = event.getVersion() != event.getOldVersion(); if (is_updated) { console.log('database connected with new schema'); } else if (isNaN(event.getOldVersion())) { console.log('new database created'); } else { console.log('existing database connected'); } // heavy database operations should start from this. }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload