[Bug 14985] New: Specify how autoincrement + empty keypath works

http://www.w3.org/Bugs/Public/show_bug.cgi?id=14985

           Summary: Specify how autoincrement + empty keypath works
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Indexed Database API
        AssignedTo: dave.null@w3.org
        ReportedBy: jonas@sicking.cc
         QAContact: member-webapi-cvs@w3.org
                CC: mike@w3.org, public-webapps@w3.org


What should happen for the following calls?

store = db.createObjectStore("mystore", { keyPath: "", autoIncrement: true });
store.add(1);           // store an item with key 1
store.add("foo");       // store an item with key "foo"
store.add({foo:"bar"}); // throw

It seems like if you have a objectStore with an empty keyPath and autoIncrement
set to true, you'll either a valid key as the raw value, in which case that
value is used as key. Or you'll specify an invalid key as value, in which case
we should throw since it's not a valid key. In neither case would we actually
use the key generator.

It seems to me that the simplest solution is to not allow an empty keyPath and
autoIncrement set to true.

We would of course still allow no keypath and autoIncrement set to true. I.e.
we'd still allow out-of-line keys together with autoIncrement. As well as
non-empty keypaths with autoincrement set to true.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Tuesday, 29 November 2011 00:23:37 UTC