Closed Bug 692659 Opened 13 years ago Closed 13 years ago

IndexedDB: fix sort order for indexes

Categories

(Core :: Storage: IndexedDB, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sicking, Assigned: sicking)

References

Details

Attachments

(1 file)

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.
Attached patch Patch to fixSplinter Review
Assignee: nobody → jonas
Status: NEW → ASSIGNED
Attachment #572748 - Flags: review?(bent.mozilla)
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+
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.

Attachment

General

Created:
Updated:
Size: