W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2011

IndexedDB: updates through cursors on indexes that change the key

From: Hans Wennborg <hans@chromium.org>
Date: Tue, 1 Feb 2011 18:07:48 +0000
Message-ID: <AANLkTinK5p2hvzunMQD0BfJ0hi9KnRBtQ4R-TNKCjnL9@mail.gmail.com>
To: public-webapps@w3.org
For cursors on object stores, we disallow updates that change the key:
one cannot provide an explicit key, and for object stores with a key
path, the spec says that "If the effective object store of this cursor
uses in-line keys and evaluating the key path of the value parameter
results in a different value than the cursor's effective key, this
method throws DATA_ERR."

I suppose the reason is that an implementation may have trouble
handling such updates, i.e. changing the keys that the cursor iterates
over during the iteration is a bad idea.

A similar situation can occur with cursors over indexes:

Say that there is an object store with objects like {fname: 'John',
lname: 'Doe', phone: 1234}, and an index with 'fname' as key path.
When iterating over the index with a cursor, should it be allowed to
update the objects so that the key in the index, in this case the
'fname', of an object is changed? The situation seems analogous to the
one above, but as far as I can see, the spec does not mention this.
Should it be allowed?

I would be interested to hear your thoughts on this.

Received on Tuesday, 1 February 2011 18:08:40 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:29 UTC