Closed Bug 692629 Opened 10 years ago Closed 10 years ago

IndexedDB: Support IDBObjectStore/IDBIndex.count

Categories

(Core :: Storage: IndexedDB, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sicking, Assigned: bent.mozilla)

References

Details

(Keywords: dev-doc-complete, Whiteboard: [inbound])

Attachments

(1 file, 1 obsolete file)

Takes a keyrange or a value
Attached patch Patch, v1 (obsolete) — Splinter Review
Assignee: nobody → bent.mozilla
Status: NEW → ASSIGNED
Attachment #571025 - Flags: review?(jonas)
Attached patch Patch, v1.1Splinter Review
Better index query.
Attachment #571025 - Attachment is obsolete: true
Attachment #571025 - Flags: review?(jonas)
Attachment #571059 - Flags: review?(jonas)
Comment on attachment 571059 [details] [diff] [review]
Patch, v1.1

Review of attachment 571059 [details] [diff] [review]:
-----------------------------------------------------------------

r=me

::: dom/indexedDB/IDBIndex.cpp
@@ +1456,5 @@
> +  NS_NAMED_LITERAL_CSTRING(id, "id");
> +
> +  nsCString query = NS_LITERAL_CSTRING("SELECT count(*) FROM ") + table +
> +                    NS_LITERAL_CSTRING(" WHERE index_id = :") + id +
> +                    keyRangeClause;

Why not make the middle line:

NS_LITERAL_CSTRING(" WHERE index_id = :id") +

::: dom/indexedDB/IDBObjectStore.cpp
@@ +2402,5 @@
> +  }
> +
> +  nsCString query = NS_LITERAL_CSTRING("SELECT count(*) FROM ") + table +
> +                    NS_LITERAL_CSTRING(" WHERE object_store_id = :") + osid +
> +                    keyRangeClause;

Same here
Attachment #571059 - Flags: review?(jonas) → review+
(In reply to Jonas Sicking (:sicking) from comment #3)
> Why not make the middle line:
> 
> NS_LITERAL_CSTRING(" WHERE index_id = :id") +

It's to avoid making more string data. We do the same all over indexeddb code.
https://hg.mozilla.org/mozilla-central/rev/776dc60cee13
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
I'm in the process of documenting this change. If I understand well both the code and the spec (and its history), right now (i.e. in Firefox 10), the two new methods implemented by this bug raise IDBDatabaseException and not yet raw DOMException as in the spec. The change in exception will come in the future in bug 693061.

Is this correct?
Component: DOM → DOM: IndexedDB
Target Milestone: mozilla10 → ---
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.