Closed Bug 589355 Opened 15 years ago Closed 15 years ago

IndexedDB: Add IDBObjectStore::Clear

Categories

(Core :: Storage: IndexedDB, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bent.mozilla, Assigned: bent.mozilla)

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 1 obsolete file)

Attached patch Patch, v1 (obsolete) — Splinter Review
For clearing object stores.
Attachment #467974 - Flags: review?(jonas)
Comment on attachment 467974 [details] [diff] [review] Patch, v1 >+ClearHelper::DoDatabaseWork(mozIStorageConnection* aConnection) >+{ >+ NS_PRECONDITION(aConnection, "Passed a null connection!"); >+ >+ nsCString table; >+ if (mAutoIncrement) { >+ table.AssignLiteral("ai_object_data"); >+ } >+ else { >+ table.AssignLiteral("object_data"); >+ } >+ >+ NS_NAMED_LITERAL_CSTRING(osid, "osid"); >+ >+ nsCString query = NS_LITERAL_CSTRING("DELETE FROM ") + table + >+ NS_LITERAL_CSTRING(" WHERE object_store_id = :") + osid; This will create needless string concatenation. If you don't want to duplicate the string "osid" (which IMHO would be ok to duplicate), then use a #define or some such. You should test that clearing a objectStore does *not* reset its autoincrement counter. r=me with that.
Attachment #467974 - Flags: review?(jonas) → review+
Attached patch Patch, v1.1Splinter Review
With comments addressed. Requesting approval for spec compliance. Has tests.
Attachment #467974 - Attachment is obsolete: true
Attachment #469298 - Flags: review+
Attachment #469298 - Flags: approval2.0?
Attachment #469298 - Flags: approval2.0? → approval2.0+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Keywords: dev-doc-needed
Target Milestone: --- → mozilla2.0b5
Component: DOM → DOM: IndexedDB
Target Milestone: mozilla2.0b5 → ---
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: