W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

RE: [IndexedDB] Need a method to clear an object store

From: Pablo Castro <Pablo.Castro@microsoft.com>
Date: Wed, 4 Aug 2010 17:35:21 +0000
To: Jonas Sicking <jonas@sicking.cc>, ben turner <bent.mozilla@gmail.com>
CC: public-webapps WG <public-webapps@w3.org>
Message-ID: <F753B2C401114141B426DB383C8885E05900743C@TK5EX14MBXC126.redmond.corp.microsoft.com>

From: public-webapps-request@w3.org [mailto:public-webapps-request@w3.org] On Behalf Of Jonas Sicking
Sent: Tuesday, August 03, 2010 12:21 PM

>> On Tue, Aug 3, 2010 at 12:09 PM, ben turner <bent.mozilla@gmail.com> wrote:
>> > Hi folks,
>> >
>> > Currently there are only two ways to clear an object store of all
>> > data: (i) remove the object store and recreate it, or (ii) open a
>> > cursor and call remove for all entries. I propose a third, simpler
>> > approach:
>> >
>> > interface IDBObjectStore
>> > {
>> >  ...
>> >  void clear();
>> >  ...
>> > };
>> >
>> > Any thoughts?
>>
>> Some background. At least in our implementation, removing each
>> individual item is significantly slower than removing and recreating
>> the objectStore. It's also significantly slower than a 'clear'
>> function is. And while tearing down and recreating the objectStore
>> works, it's fairly complex if there are multiple indexes on the store.
>> Adding a clear() function, while redundant, should make things easier
>> for developers while adding very little work in the implementation.
>>
>> I think there is a bug in the above proposal though. clear() should
>> return a IDBRequest. However the .result of the request should likely
>> be null.
>>
>> / Jonas

+1 on having clear(). We ran into the need also while playing with samples and such.

-pablo
Received on Wednesday, 4 August 2010 17:35:55 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:40 GMT