Last Comment Bug 692629 - IndexedDB: Support IDBObjectStore/IDBIndex.count
: IndexedDB: Support IDBObjectStore/IDBIndex.count
Status: RESOLVED FIXED
[inbound]
: dev-doc-complete
Product: Core
Classification: Components
Component: DOM: IndexedDB (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Ben Turner (not reading bugmail, use the needinfo flag!)
:
Mentors:
Depends on:
Blocks: idb
  Show dependency treegraph
 
Reported: 2011-10-06 15:43 PDT by Jonas Sicking (:sicking) PTO Until July 5th
Modified: 2012-03-22 11:53 PDT (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch, v1 (27.72 KB, patch)
2011-11-01 09:02 PDT, Ben Turner (not reading bugmail, use the needinfo flag!)
no flags Details | Diff | Splinter Review
Patch, v1.1 (27.11 KB, patch)
2011-11-01 10:56 PDT, Ben Turner (not reading bugmail, use the needinfo flag!)
jonas: review+
Details | Diff | Splinter Review

Description Jonas Sicking (:sicking) PTO Until July 5th 2011-10-06 15:43:10 PDT
Takes a keyrange or a value
Comment 1 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-01 09:02:55 PDT
Created attachment 571025 [details] [diff] [review]
Patch, v1
Comment 2 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-01 10:56:17 PDT
Created attachment 571059 [details] [diff] [review]
Patch, v1.1

Better index query.
Comment 3 Jonas Sicking (:sicking) PTO Until July 5th 2011-11-01 22:46:29 PDT
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
Comment 5 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-03 09:18:07 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/776dc60cee13
Comment 6 Ben Turner (not reading bugmail, use the needinfo flag!) 2011-11-03 09:19:12 PDT
(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 Ed Morley [:emorley] 2011-11-03 13:11:01 PDT
https://hg.mozilla.org/mozilla-central/rev/776dc60cee13
Comment 8 Jean-Yves Perrier [:teoli] 2011-11-20 12:37:06 PST
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?
Comment 9 Jonas Sicking (:sicking) PTO Until July 5th 2011-11-20 19:07:06 PST
Yes, that's correct.

Note You need to log in before you can comment on or make changes to this bug.