This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26774 - Specification does not distinguish between `IDBObjectStore` `add` and `put`
Summary: Specification does not distinguish between `IDBObjectStore` `add` and `put`
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2014-09-10 17:07 UTC by Sam Giles
Modified: 2014-09-10 19:03 UTC (History)
4 users (show)

See Also:


Description Sam Giles 2014-09-10 17:07:07 UTC
The specification for `add` and `put` are seemingly identical in the current working draft perhaps bar a typo referring to structured cloning.

Are they intentionally identical?

The naming suggests that `put` would be idempotent and add would _always_ create a new entry or error if it's not possible.  If they are intentionally identical are two functions absolutely necessary?
Comment 1 Joshua Bell 2014-09-10 17:43:38 UTC
Both methods say "[run] the steps for storing a record into an object store..."

add() has:

"...with the no-overwrite flag flag set to true."

put() has:

...with the no-overwrite flag flag set to false."

which is the crux of the difference between them. The operation steps later in the spec detail how the no-overwrite flag is interpreted.

(I'm guessing you missed this. If so, no worries. If not, my apologies - what am *I* missing?)
Comment 2 Sam Giles 2014-09-10 19:03:55 UTC
No, I'd missed that detail. Apologies.  Thanks for the very prompt response! :D