This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16133 - [IndexedDB] update createObjectStore examples to use optionalParameters
Summary: [IndexedDB] update createObjectStore examples to use optionalParameters
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-27 11:41 UTC by Odin Hørthe Omdal
Modified: 2012-03-09 20:52 UTC (History)
3 users (show)

See Also:


Attachments

Description Odin Hørthe Omdal 2012-02-27 11:41:41 UTC
3.3.3 Object Store

First example using createObjectStore is wrong.

3.3.4 Index

First example using createObjectStore is wrong.
Comment 1 Eliot Graff 2012-03-09 20:52:40 UTC
The samples have been updated as follows:

Section 3.3.3 (First Sample)
OLD
var db = indexedDBSync.open('AddressBook', 1, function(trans, oldVersion) {
  trans.db.createObjectStore('Contact', 'id', true);
});
NEW
var db = indexedDBSync.open('AddressBook', 1, function(trans, oldVersion) {
  trans.db.createObjectStore('Contact', {keyPath:'id', autoIncrement:true} );
});

Section 3.3.4 (First Sample)
OLD
var db = indexedDBSync.open('AddressBook', 2, function(trans, oldVersion) {
  if (oldVersion === 1) {
    trans.db.createObjectStore('Contact', 'id', true);
  }
  var store = vtx.objectStore('Contact');
  store.createIndex('ContactName', 'name', false);
});
NEW
var db = indexedDBSync.open('AddressBook', 2, function(trans, oldVersion) {
  if (oldVersion === 1) {
    trans.db.createObjectStore('Contact', {keyPath:'id', autoIncrement:true});
  }
  var store = vtx.objectStore('Contact');
  store.createIndex('ContactName', {unique:false, multiEntry:false});
});



Thanks!
Eliot