var store=idb.stores[sn]
var key={};
key[store['keytype']]=store['keyname'];
- cl("idb: creating store '"+sn+"'");
+ cl("idb: creating store '"+sn+"' ("+
+ store.keytype+": "+store.keyname+")");
store.os=idb.handle.createObjectStore(sn,key);
// indices
if(store.idx!==undefined) {
idb.successcb=successcb;
if(upgradecb!==undefined)
idb.onupgradeneeded=upgradecb;
+ cl("idb: init database '"+idb.name+"'");
var req=indexedDB.open(idb.name,idb.version);
req.onsuccess=idb.onsuccess;
req.onupgradeneeded=idb.onupgradeneeded;
var res=cursor.update(nitem);
res.onsuccess=function(event) {
cl("idb: updated cursor");
- callback(event);
+ if(callback!==undefined)
+ callback(event);
};
res.onerror=function(error) {
cl("idb: cursor update error");
var addreq=store.add(nitem,num);
addreq.onsuccess=function(event) {
cl("idb: added (update mode) key "+num);
- callback(event);
+ if(callback!==undefined)
+ callback(event);
}
addreq.onerror=function(error) {
cl("idb: error add (update mode)");