- From: Keean Schupke <keean@fry-it.com>
- Date: Mon, 8 Nov 2010 18:46:02 +0000
- To: Jonas Sicking <jonas@sicking.cc>
- Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Webapps WG <public-webapps@w3.org>
- Message-ID: <AANLkTiknchGsqkNDhAYPg3xa7HUvk=O5SG2Ex0PXac5q@mail.gmail.com>
Obviously I need to the key and value the correct way around for 'put'... Cheers, Keean. On 8 November 2010 18:41, Keean Schupke <keean@fry-it.com> wrote: > Hi, > > In code, if: > > idbObjectStoreSync.put(key, undefined) does the same as > idbObjectStoreSync.remove(key) > > then > > idbObjectStoreSync.get(key) can safely return undefined for no such key > exists. > > > Consider: > > idbObjectStoreSync.put('mykey', undefined); // deletes the object stored > under mykey or noop. > idbObjectStoreSync.get('mykey'); // returns 'undefined' > idbObjectStoreSync.put('mykey', myobject); > idbObjectStoreSync.get('mykey'); // returns 'myobject' > idbObjectStoreSync.put('mykey', undefined); // deletes the object stored > under mykey or noop. > idbObjectStoreSync.get('mykey'); // returns 'undefined' > > > Cheers, > Keean. > > > On 8 November 2010 18:27, Jonas Sicking <jonas@sicking.cc> wrote: > >> On Mon, Nov 8, 2010 at 10:06 AM, Keean Schupke <keean@fry-it.com> wrote: >> > It would make sense if you make setting a key to undefined semantically >> > equivalent to deleting the value (and no error if it does not exist), >> and >> > return undefined on a get when no such key exists. That way 'undefined' >> > cannot exist as a value in the object store, and is a safe marker for >> the >> > key not existing in that index. >> >> I'm not sure I follow. There is no way to set a key on an existing >> entry in an object store. The closest thing would be >> IDBCursor.update(), but it specifically disallow changing the key at >> all. >> >> / Jonas >> > >
Received on Monday, 8 November 2010 18:46:31 UTC