Closed
Bug 692659
Opened 13 years ago
Closed 13 years ago
IndexedDB: fix sort order for indexes
Categories
(Core :: Storage: IndexedDB, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: sicking, Assigned: sicking)
References
Details
Attachments
(1 file)
5.98 KB,
patch
|
bent.mozilla
:
review+
|
Details | Diff | Splinter Review |
Consider the following data. The keypath for the objectStore is "id", and the keyPath for the index is "name".
{ id: 1, name: "a" }
{ id: 2, name: "b" }
{ id: 3, name: "b" }
{ id: 4, name: "b" }
{ id: 5, name: "d" }
{ id: 6, name: "c" }
When creating a cursor on the index, you should get the following results for the following directions of the cursor:
NEXT:
key: "a", primaryKey "1"
key: "b", primaryKey "2"
key: "b", primaryKey "3"
key: "b", primaryKey "4"
key: "c", primaryKey "6"
key: "d", primaryKey "5"
NEXT_NO_DUPLICATE:
key: "a", primaryKey "1"
key: "b", primaryKey "2"
key: "c", primaryKey "6"
key: "d", primaryKey "5"
PREV:
key: "d", primaryKey "5"
key: "c", primaryKey "6"
key: "b", primaryKey "4"
key: "b", primaryKey "3"
key: "b", primaryKey "2"
key: "a", primaryKey "1"
PREV_NO_DUPLICATE:
key: "d", primaryKey "5"
key: "c", primaryKey "6"
key: "b", primaryKey "2"
key: "a", primaryKey "1"
I think currently we get the PREV order wrong. But the PREV_NO_DUPLICATE query seems to execute in a very suboptimal way that doesn't use indexes properly.
I *think* I have ideas for how to write SQL queries that produce this result, feel free to ping me.
Assignee | ||
Comment 1•13 years ago
|
||
Comment on attachment 572748 [details] [diff] [review]
Patch to fix
Review of attachment 572748 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great!
Attachment #572748 -
Flags: review?(bent.mozilla) → review+
Assignee | ||
Comment 3•13 years ago
|
||
Checked in https://hg.mozilla.org/mozilla-central/rev/504d3127b9a6
Thanks again for such a quick review!
Assignee | ||
Updated•13 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Component: DOM → DOM: IndexedDB
Version: Trunk → unspecified
You need to log in
before you can comment on or make changes to this bug.
Description
•