[Bug 11270] New: Interaction between in-line keys and key generators

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11270 Summary: Interaction between in-line keys and key generators Product: WebAppsWG Version: unspecified Platform: PC OS/Version: All Status: NEW Severity: normal Prio

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 4:16 PM, Jonas Sicking wrote: >>> Similar to Kris, I think worrying about 'undefined' is worrying about >>> an edge case. Simplicity is better than trying to cove every possible >>> edge case. >> >> I thought edge cases are precisely what a specification is supposed to deal

[Bug 11269] New: Evaluating keyPaths needs to be better specified

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11269 Summary: Evaluating keyPaths needs to be better specified Product: WebAppsWG Version: unspecified Platform: PC OS/Version: All Status: NEW Severity: normal Priorit

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
Sounds good to me... Cheers, Keean. On 9 November 2010 00:16, Jonas Sicking wrote: > On Mon, Nov 8, 2010 at 4:04 PM, Keean Schupke wrote: > > Hi, > > > >> > >> Why do you want to check that a key exists before you delete it? Why > >> not just call delete(key) always and rest assured that it's

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 4:04 PM, Keean Schupke wrote: > Hi, > >> >> Why do you want to check that a key exists before you delete it? Why >> not just call delete(key) always and rest assured that it's gone? > > because it will throw an exception if the key does not exist... That is no longer the ca

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
Hi, > Why do you want to check that a key exists before you delete it? Why > not just call delete(key) always and rest assured that it's gone? > > because it will throw an exception if the key does not exist... > Don't you need to coordinate with other developers to know what any > other value

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 3:33 PM, Keean Schupke wrote: > If more than one developer are working on a project, there is no way I can > know if the other developer has put 'undefined' objects into the store > (unless the specification enforces it). > So every time I am checking if a key exists (maybe

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Kris Zyp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 If you are looking for ways to shoot yourself in the foot, why not just do: undefined = true; Storing undefined is not an important use case, practical usage is far more important than optimizing for edge cases just because you can think of them. Kri

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
If more than one developer are working on a project, there is no way I can know if the other developer has put 'undefined' objects into the store (unless the specification enforces it). So every time I am checking if a key exists (maybe to delete the key) I need to check if it _really_ exists, or

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Kris Zyp
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 +1 from me. The purpose of undefined in JavaScript is to represent the value of a non-existent key, it fits perfectly with get() for a key that doesn't exist. This is exactly how property access works with JavaScript objects, so it is consistent and

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 3:18 PM, Keean Schupke wrote: > Let me put it another way. Why do you want to allow putting 'undefined' into > the object store? All that does is make the API for get ambiguous. What does > it gain you? Why do you want to make 'get' ambiguous? It seems like a loose-loose si

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
Let me put it another way. Why do you want to allow putting 'undefined' into the object store? All that does is make the API for get ambiguous. What does it gain you? Why do you want to make 'get' ambiguous? I think having an unambiguous API for 'get' is worth more than being able to 'put' 'undefi

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 2:39 PM, Keean Schupke wrote: > The problem I am trying to solve is not knowing if "get(key) === undefined" > means the key does not exist or there is a key with a value of undefined. > The solution is to disallow inserting undefined. Now there is no ambiguity, > if get(key)

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
The problem I am trying to solve is not knowing if "get(key) === undefined" means the key does not exist or there is a key with a value of undefined. The solution is to disallow inserting undefined. Now there is no ambiguity, if get(key) returns undefined, it _must_ be because the key does not exi

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 1:41 PM, Keean Schupke wrote: > What is the use case for storing undefined in an object-store? I don't know. But if that's not the problem you were trying to solve, then what problem were you trying to solve? / Jonas

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

2010-11-08 Thread Jonas Sicking
On Wed, Aug 4, 2010 at 10:35 AM, Pablo Castro wrote: > > From: public-webapps-requ...@w3.org [mailto:public-webapps-requ...@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 wrote: >>> > Hi folks, >>> > >>> > Currentl

[Bug 11266] Add IDBObjectStore.clear()

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11266 Jonas Sicking changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
What is the use case for storing undefined in an object-store? Cheers, Keean. On 8 November 2010 20:59, Jonas Sicking wrote: > On Mon, Nov 8, 2010 at 12:02 PM, Keean Schupke wrote: > > Hi, > > > >> > I don't understand that. > >> > with the proposal, undefined clearly means the entry does not

Re: [IndexedDB] .value of no-duplicate cursors

2010-11-08 Thread Jonas Sicking
This discussion seemed to die off with no clear resolution. Since I had forgotten about this thread I specified that the first item is always the one returned for _NO_DUPLICATE cursors. Where "first" means "with lowest object-store key". I don't feel strongly either way if they should be removed

[Bug 11266] New: Add IDBObjectStore.clear()

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11266 Summary: Add IDBObjectStore.clear() Product: WebAppsWG Version: unspecified Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Compone

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 12:02 PM, Keean Schupke wrote: > Hi, > >> > I don't understand that. >> > with the proposal, undefined clearly means the entry does not exist as >> > there is no way to put an undefined into the object store (as >> > .put(undefined, key) deletes the entry). >> >> The confusi

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
Hi, > I don't understand that. > > with the proposal, undefined clearly means the entry does not exist as > there is no way to put an undefined into the object store (as > .put(undefined, key) deletes the entry). > > The confusing part is that a function called 'put' actually deletes > something,

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Monday, November 8, 2010, Keean Schupke wrote: > Hi, > Indeed. But I think this is more unexpected and confusing than having > .get() return the same thing if the entry exists as if it contains > undefined. > > / Jonas > > I don't understand that. > with the proposal, undefined clearly means th

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
I was only suggesting this as it makes the operations symmetrical in the sense that if "get" returns undefined for "key does not exist", "put(undefined, key)" should mean make this key not exist, in a declarative sense. For me this is clearer than the alternatives (which may require exceptions to

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
Hi, > Indeed. But I think this is more unexpected and confusing than having > .get() return the same thing if the entry exists as if it contains > undefined. > > / Jonas > I don't understand that. with the proposal, undefined clearly means the entry does not exist as there is no way to put an u

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 10:41 AM, Keean Schupke 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(

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
Obviously I need to the key and value the correct way around for 'put'... Cheers, Keean. On 8 November 2010 18:41, Keean Schupke wrote: > Hi, > > In code, if: > > idbObjectStoreSync.put(key, undefined) does the same as > idbObjectStoreSync.remove(key) > > then > > idbObjectStoreSync.get(key)

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
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 noo

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
On Mon, Nov 8, 2010 at 10:06 AM, Keean Schupke 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

[Bug 9882] Behavior when attempting to write data to an objectStore opened as read only unspecified

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=9882 Jonas Sicking changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Keean Schupke
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

Re: [IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Tab Atkins Jr.
On Mon, Nov 8, 2010 at 8:24 AM, Jonas Sicking wrote: > Hi All, > > One of the things we discussed at TPAC was the fact that > IDBObjectStore.get() and IDBObjectStore.delete() currently fire an > error event if no record with the supplied key exists. > > Especially for .delete() this seems suboptim

[IndexedDB] Behavior of IDBObjectStore.get() and IDBObjectStore.delete() when record doesn't exist

2010-11-08 Thread Jonas Sicking
Hi All, One of the things we discussed at TPAC was the fact that IDBObjectStore.get() and IDBObjectStore.delete() currently fire an error event if no record with the supplied key exists. Especially for .delete() this seems suboptimal as the author wanted the entry with the given key removed anywa

[Bug 10402] [IndexedDB] IDBCursor.remove/update behavior when at end of range unspecified

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10402 Jonas Sicking changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

[Bug 10430] [IndexedDB] We need to make it more clear IDBRequests can be reused and spec readyState's behavior

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10430 Jonas Sicking changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|

[Bug 11187] [IndexedDB] Repeated calls to IDBCursor.continue() should throw

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11187 Jonas Sicking changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|

[Bug 10088] The spec does not define what happens if an object store is modified while a cursor is iterating it.

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10088 Jonas Sicking changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|

[Bug 10058] Specify order for indexes which contain duplicate key values

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10058 Jonas Sicking changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|

[Bug 11246] Remove IDBCursor(Sync).count

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11246 Jonas Sicking changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

[Bug 11094] [IndexedDB] IDBIndex.get* don't define which item is returned in the case of duplicates

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11094 Jonas Sicking changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|

[Bug 11257] New: Should IDBCursor.update be able to create a new entry?

2010-11-08 Thread bugzilla
http://www.w3.org/Bugs/Public/show_bug.cgi?id=11257 Summary: Should IDBCursor.update be able to create a new entry? Product: WebAppsWG Version: unspecified Platform: PC OS/Version: All Status: NEW Severity: normal P