IndexedDB: Support IDBObjectStore/IDBIndex.count

RESOLVED FIXED

Status

()

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

People

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

Tracking

({dev-doc-complete})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [inbound])

Attachments

(1 attachment, 1 obsolete attachment)

Takes a keyrange or a value
Created attachment 571025 [details] [diff] [review]
Patch, v1
Assignee: nobody → bent.mozilla
Status: NEW → ASSIGNED
Attachment #571025 - Flags: review?(jonas)
Created attachment 571059 [details] [diff] [review]
Patch, v1.1

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+

Comment 4

6 years ago
Landing on inbound in:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b5c0bfd03fcf

Backed out for failing to build on any platform:
https://tbpl.mozilla.org/?tree=Mozilla-Inbound&rev=5675bf2c7930

https://hg.mozilla.org/integration/mozilla-inbound/rev/72042cd154b9
OS: Mac OS X → All
Hardware: x86 → All
https://hg.mozilla.org/integration/mozilla-inbound/rev/776dc60cee13
Whiteboard: [inbound]
(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.

Comment 7

6 years ago
https://hg.mozilla.org/mozilla-central/rev/776dc60cee13
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
Keywords: dev-doc-needed
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?
Yes, that's correct.
Thank you.

Grendel already updated 
https://developer.mozilla.org/en/IndexedDB/IDBIndex#count

I updated:
https://developer.mozilla.org/en/IndexedDB/IDBObjectStore#count

and of course:
https://developer.mozilla.org/en/Firefox_10_for_developers
Keywords: dev-doc-needed → dev-doc-complete
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.