IndexedDB: Add IDBObjectStore::Clear

RESOLVED FIXED

Status

()

Core
DOM: IndexedDB
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: Ben Turner (not reading bugmail, use the needinfo flag!), Assigned: Ben Turner (not reading bugmail, use the needinfo flag!))

Tracking

({dev-doc-complete})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Created attachment 467974 [details] [diff] [review]
Patch, v1

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+
Created attachment 469298 [details] [diff] [review]
Patch, v1.1

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?

Updated

7 years ago
Attachment #469298 - Flags: approval2.0? → approval2.0+
http://hg.mozilla.org/mozilla-central/rev/c37dead0da88
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED

Updated

7 years ago
Keywords: dev-doc-needed
Target Milestone: --- → mozilla2.0b5

Updated

7 years ago
Keywords: dev-doc-needed → dev-doc-complete
Component: DOM → DOM: IndexedDB
Target Milestone: mozilla2.0b5 → ---
You need to log in before you can comment on or make changes to this bug.